altosui: Check for map and stats table when changing units/fonts in graph
authorKeith Packard <keithp@keithp.com>
Mon, 29 Sep 2014 19:57:27 +0000 (12:57 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 29 Sep 2014 19:57:27 +0000 (12:57 -0700)
AltosGraphUI wasn't making sure the map and stats tables were present
before attempting to adjust font size and units.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosGraphUI.java

index ddd281a6d41813453cedb2a932211eb99d7d88c9..2d00fb45a74be84e0198d1c7c4c8c195c8b07544 100644 (file)
@@ -55,12 +55,15 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
        }
 
        public void font_size_changed(int font_size) {
        }
 
        public void font_size_changed(int font_size) {
-               map.font_size_changed(font_size);
-               statsTable.font_size_changed(font_size);
+               if (map != null)
+                       map.font_size_changed(font_size);
+               if (statsTable != null)
+                       statsTable.font_size_changed(font_size);
        }
 
        public void units_changed(boolean imperial_units) {
        }
 
        public void units_changed(boolean imperial_units) {
-               map.units_changed(imperial_units);
+               if (map != null)
+                       map.units_changed(imperial_units);
        }
 
        AltosGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException {
        }
 
        AltosGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException {