Skip to content

Commit b669062

Browse files
committed
优化 RequestHandler 一处代码判空
1 parent 61cfc0d commit b669062

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/com/hjq/easy/demo/http/model/RequestHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.net.ConnectivityManager;
88
import android.net.NetworkInfo;
99
import androidx.annotation.NonNull;
10-
import com.google.gson.JsonSyntaxException;
1110
import com.hjq.easy.demo.R;
1211
import com.hjq.easy.demo.http.exception.ResultException;
1312
import com.hjq.easy.demo.http.exception.TokenException;
@@ -180,7 +179,8 @@ public Throwable requestFail(@NonNull HttpRequest<?> httpRequest, @NonNull Throw
180179
return new CancelException(mApplication.getString(R.string.http_request_cancel), throwable);
181180
}
182181

183-
return new HttpException(throwable.getMessage(), throwable);
182+
String message = throwable.getMessage();
183+
return new HttpException(message != null ? message : "", throwable);
184184
}
185185

186186
@NonNull

0 commit comments

Comments
 (0)