Fixed a couple of crashes caused by accessing invalid data
This commit is contained in:
parent
daccf8d1e8
commit
92e1341e63
1 changed files with 28 additions and 28 deletions
|
@ -101,7 +101,7 @@ public class NetworkService extends Service {
|
|||
|
||||
public int sendMessage(ApiCallable apiCallable, int requiredApi){
|
||||
int apiId = 0;
|
||||
if(requiredApi != -1){
|
||||
if(requiredApi != -1 && mApiIds.containsKey(requiredApi)){
|
||||
apiId = mApiIds.get(requiredApi);
|
||||
}
|
||||
ApiCall call = apiCallable.toApiCall(apiId, mCurrentId);
|
||||
|
@ -173,6 +173,7 @@ public class NetworkService extends Service {
|
|||
|
||||
// We will only handle messages that relate to the login and API accesses here.
|
||||
if(response.result != null){
|
||||
if(response.result instanceof Double || response.result instanceof Boolean){
|
||||
if(mLastCall == RPC.CALL_LOGIN){
|
||||
isLoggedIn = true;
|
||||
|
||||
|
@ -205,8 +206,7 @@ public class NetworkService extends Service {
|
|||
|
||||
// All calls have been handled at this point
|
||||
mLastCall = "";
|
||||
}else{
|
||||
Log.d(TAG,"New unhandled message");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Log.w(TAG,"Error.Msg: "+response.error.message);
|
||||
|
|
Loading…
Reference in a new issue