diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsInputStream.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsInputStream.java index 6af110171f..17d86f0e76 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsInputStream.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsInputStream.java @@ -77,6 +77,7 @@ public void run() { mainHandler.dispatchMessage(mainHandler.obtainMessage(MSG_INPUT, msg)); } else { mainHandler.dispatchMessage(mainHandler.obtainMessage(MSG_TEARDOWN, "null message")); + break; // if input is empty, do not continue looping } } } catch (IOException e) { diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java index efbbb4b322..96f3752559 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java @@ -323,7 +323,7 @@ private void send(Message message) { private void sendOutputStream(int what, Object obj) { McsOutputStream os = outputStream; - if (os != null) { + if (os != null && os.isAlive()) { Handler outputHandler = os.getHandler(); if (outputHandler != null) outputHandler.sendMessage(outputHandler.obtainMessage(what, obj));