aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-09-27 22:07:05 +0200
committerChristian Schneppe <christian@pix-art.de>2016-09-27 22:07:05 +0200
commitee9df9c978f76403d7d41690822f9432d56ec1a4 (patch)
tree2f1a3c0e01d74bbecfaf850764c8e0720dfc5aa5 /src/main/java/de/pixart
parentd90f4556868d95e041a06d31107ae87295ab7a57 (diff)
catch NPE while loading location
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
index 38dc8fead..3bfecddfa 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
@@ -168,6 +168,8 @@ public class ShowLocationActivity extends Activity implements OnMapReadyCallback
@Override
protected void onPreExecute() {
super.onPreExecute();
+ marker = mGoogleMap.addMarker(options);
+ marker.showInfoWindow();
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(location, Config.DEFAULT_ZOOM));
}
@@ -180,6 +182,7 @@ public class ShowLocationActivity extends Activity implements OnMapReadyCallback
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
+ marker.remove();
options.snippet(String.valueOf(address));
marker = mGoogleMap.addMarker(options);
marker.showInfoWindow();
@@ -190,7 +193,9 @@ public class ShowLocationActivity extends Activity implements OnMapReadyCallback
mGoogleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
- marker.showInfoWindow();
+ if (marker != null) {
+ marker.showInfoWindow();
+ }
}
});
}