From be33c91823efd426fcdf1da239dcc83ed19705ef Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 14 Jun 2018 11:50:35 -0500 Subject: [PATCH] Only sending a message if we have the API id --- .../graphenej/api/android/NetworkService.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java index 1e85968..b08256f 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java @@ -151,15 +151,14 @@ public class NetworkService extends Service { } public long sendMessage(ApiCallable apiCallable, int requiredApi){ - int apiId = 0; if(requiredApi != -1 && mApiIds.containsKey(requiredApi)){ - apiId = mApiIds.get(requiredApi); - } - ApiCall call = apiCallable.toApiCall(apiId, ++mCurrentId); - mRequestClassMap.put(mCurrentId, apiCallable.getClass()); - if(mWebSocket != null && mWebSocket.send(call.toJsonString())){ - Log.v(TAG,"-> "+call.toJsonString()); - return mCurrentId; + int apiId = mApiIds.get(requiredApi); + ApiCall call = apiCallable.toApiCall(apiId, ++mCurrentId); + mRequestClassMap.put(mCurrentId, apiCallable.getClass()); + if(mWebSocket != null && mWebSocket.send(call.toJsonString())){ + Log.v(TAG,"-> "+call.toJsonString()); + return mCurrentId; + } } return -1; }