Fix potential NPE in startup guide

DroidFish.reInitUI() could potentially set tourGuide to null while tap
events are already queued but not yet processed. Avoid NPE in this
situation.
This commit is contained in:
Peter Osterlund 2019-07-20 08:36:43 +02:00
parent 0dd276ba22
commit f463990029

View File

@ -680,14 +680,19 @@ public class DroidFish extends Activity
Editor editor = settings.edit();
editor.putBoolean("guideShowOnStart", false);
editor.apply();
if (tourGuide != null) {
tourGuide.next();
tourGuide = null;
}
}));
Sequence sequence = new Sequence.SequenceBuilder()
.add(guides.toArray(new TourGuide[0]))
.setDefaultOverlay(new Overlay()
.setOnClickListener(v -> tourGuide.next()))
.setOnClickListener(v -> {
if (tourGuide != null)
tourGuide.next();
}))
.setDefaultPointer(new Pointer())
.setContinueMethod(Sequence.ContinueMethod.OverlayListener)
.build();