@@ -238,7 +238,7 @@ public void onSaveInstanceState(Bundle savedInstanceState) {
238238 // Store the currently selected tool
239239 savedInstanceState .putString (STATE_SELECTED_TOOL , tool .name ());
240240
241- for (EditorToolsImpl toolImpl : editorToolsImpls ){
241+ for (EditorToolsImpl toolImpl : editorToolsImpls ) {
242242 toolImpl .onSaveInstanceState (savedInstanceState );
243243 }
244244 }
@@ -399,9 +399,11 @@ void setMissionProxy(MissionProxy missionProxy) {
399399 this .missionProxy = missionProxy ;
400400 }
401401
402- void onSaveInstanceState (Bundle outState ){}
402+ void onSaveInstanceState (Bundle outState ) {
403+ }
403404
404- void onRestoreInstanceState (Bundle savedState ){}
405+ void onRestoreInstanceState (Bundle savedState ) {
406+ }
405407
406408 public void onMapClick (LatLong point ) {
407409 if (missionProxy == null ) return ;
@@ -451,13 +453,13 @@ private static class MarkerToolsImpl extends EditorToolsImpl implements AdapterV
451453 super (fragment );
452454 }
453455
454- void onSaveInstanceState (Bundle outState ){
456+ void onSaveInstanceState (Bundle outState ) {
455457 super .onSaveInstanceState (outState );
456- if (selectedType != null )
458+ if (selectedType != null )
457459 outState .putString (EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE , selectedType .name ());
458460 }
459461
460- void onRestoreInstanceState (Bundle savedState ){
462+ void onRestoreInstanceState (Bundle savedState ) {
461463 super .onRestoreInstanceState (savedState );
462464 final String selectedTypeName = savedState .getString (EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE ,
463465 MARKER_ITEMS_TYPE [0 ].name ());
@@ -495,7 +497,8 @@ public void setup() {
495497 listener .skipMarkerClickEvents (true );
496498 }
497499
498- missionProxy .selection .clearSelection ();
500+ if (missionProxy != null )
501+ missionProxy .selection .clearSelection ();
499502 }
500503
501504 @ Override
@@ -530,13 +533,13 @@ private static class DrawToolsImpl extends EditorToolsImpl implements AdapterVie
530533 super (fragment );
531534 }
532535
533- void onSaveInstanceState (Bundle outState ){
536+ void onSaveInstanceState (Bundle outState ) {
534537 super .onSaveInstanceState (outState );
535- if (selectedType != null )
538+ if (selectedType != null )
536539 outState .putString (EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE , selectedType .name ());
537540 }
538541
539- void onRestoreInstanceState (Bundle savedState ){
542+ void onRestoreInstanceState (Bundle savedState ) {
540543 super .onRestoreInstanceState (savedState );
541544 final String selectedTypeName = savedState .getString (EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE ,
542545 DRAW_ITEMS_TYPE [0 ].name ());
@@ -556,7 +559,8 @@ public void setup() {
556559 listener .skipMarkerClickEvents (false );
557560 }
558561
559- missionProxy .selection .clearSelection ();
562+ if (missionProxy != null )
563+ missionProxy .selection .clearSelection ();
560564
561565 if (selectedType == MissionItemType .SURVEY ) {
562566 Toast .makeText (editorToolsFragment .getContext (), R .string .draw_the_survey_region , Toast .LENGTH_SHORT ).show ();
@@ -641,6 +645,9 @@ private static class TrashToolsImpl extends EditorToolsImpl implements OnClickLi
641645
642646 @ Override
643647 public void onListItemClick (MissionItemProxy item ) {
648+ if (missionProxy == null )
649+ return ;
650+
644651 missionProxy .removeItem (item );
645652 missionProxy .selection .clearSelection ();
646653
@@ -708,7 +715,7 @@ public void onYes() {
708715
709716 @ Override
710717 public void onNo () {
711- if (missionProxy != null )
718+ if (missionProxy != null )
712719 missionProxy .selection .clearSelection ();
713720 }
714721 });
@@ -733,6 +740,9 @@ private static class SelectorToolsImpl extends EditorToolsImpl implements OnClic
733740
734741 @ Override
735742 public void onListItemClick (MissionItemProxy item ) {
743+ if (missionProxy == null )
744+ return ;
745+
736746 if (missionProxy .selection .selectionContains (item )) {
737747 missionProxy .selection .removeItemFromSelection (item );
738748 } else {
@@ -741,6 +751,9 @@ public void onListItemClick(MissionItemProxy item) {
741751 }
742752
743753 private void selectAll () {
754+ if (missionProxy == null )
755+ return ;
756+
744757 missionProxy .selection .setSelectionTo (missionProxy .getItems ());
745758 EditorToolListener listener = editorToolsFragment .listener ;
746759 if (listener != null )
@@ -762,7 +775,9 @@ public void setup() {
762775
763776 Toast .makeText (editorToolsFragment .getContext (), "Click on mission items to select them." ,
764777 Toast .LENGTH_SHORT ).show ();
765- missionProxy .selection .clearSelection ();
778+
779+ if (missionProxy != null )
780+ missionProxy .selection .clearSelection ();
766781 }
767782
768783 @ Override
0 commit comments