android-basic-samples icon indicating copy to clipboard operation
android-basic-samples copied to clipboard

Null pointer exception is possible if loading with conflicts

Open Guaranapps opened this issue 6 years ago • 0 comments

After reading your code (quite complex for just loading/saving games) a null pointer exception could be throws after confict: snapshot variable return by processOpenDataOrConflict (see https://github.com/playgameservices/android-basic-samples/blob/884881e9854c1e07cef51a4c1efa7dab42af1221/CollectAllTheStars2/src/main/java/com/google/example/games/catt2/MainActivity.java#L686) could be null and passed to SnapshotCoordinator.discardAndClose (see https://github.com/playgameservices/android-basic-samples/blob/884881e9854c1e07cef51a4c1efa7dab42af1221/CollectAllTheStars2/src/main/java/com/google/example/games/catt2/MainActivity.java#L699) which will throw NPE while trying to call getMetadata() (see https://github.com/playgameservices/android-basic-samples/blob/884881e9854c1e07cef51a4c1efa7dab42af1221/CollectAllTheStars2/src/main/java/com/google/example/games/catt2/SnapshotCoordinator.java#L222)

Guaranapps avatar May 14 '18 14:05 Guaranapps