Skip to content

Commit 9e5e7d3

Browse files
author
Mike Burke
committed
Merge pull request #76 from mrapitis/send_broadcast_exception_fix
Catching an exception in sendbroadcast if service unexpectedly becomes u...
2 parents 461ef36 + 6b005f2 commit 9e5e7d3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,15 @@ else if (_appService != null)
625625
{
626626
return;
627627
}
628-
Context myContext = myService.getApplicationContext();
629-
if (myContext != null) myContext.sendBroadcast(sendIntent);
628+
try
629+
{
630+
Context myContext = myService.getApplicationContext();
631+
if (myContext != null) myContext.sendBroadcast(sendIntent);
632+
}
633+
catch(Exception ex)
634+
{
635+
//If the service or context has become unavailable unexpectedly, catch the exception and move on -- no broadcast log will occur.
636+
}
630637
}
631638

632639
private void writeToFile(Object writeME, String fileName) {

0 commit comments

Comments
 (0)