From: Tobias Brunner Date: Fri, 6 Jul 2018 14:01:34 +0000 (+0200) Subject: android: Make sure we actually have a tile when updating it X-Git-Tag: 5.7.2dr1~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9fb00bf89fde1cf5bbbb2f55b0592453e0db8a71;p=thirdparty%2Fstrongswan.git android: Make sure we actually have a tile when updating it Not sure when this happens exactly, in particular because the reported stack traces look like this java.lang.NullPointerException: at org.strongswan.android.ui.VpnTileService.updateTile (VpnTileService.java:220) at org.strongswan.android.ui.VpnTileService.onStartListening (VpnTileService.java:97) at android.service.quicksettings.TileService$H.handleMessage (TileService.java:407) which violates the API documentation for getQsTile(), which states: This tile is only valid for updates between onStartListening() and onStopListening(). But apparently that's not always the case. There have been two reports of such a crash, both on Android 8.0 and on Xiaomi Mi 5/6 devices, so maybe it's a bug in that particular image. --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java index 6b5cca0eb0..623a80f225 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnTileService.java @@ -204,6 +204,10 @@ public class VpnTileService extends TileService implements VpnStateService.VpnSt } Tile tile = getQsTile(); + if (tile == null) + { + return; + } if (error != VpnStateService.ErrorState.NO_ERROR) {