Fixed NullPointerException
This commit is contained in:
parent
61c9cde2f5
commit
8770575c95
@ -379,7 +379,10 @@ public class MainActivity extends AppCompatActivity
|
||||
for (Label label : labels) {
|
||||
addLabelEntry(label);
|
||||
}
|
||||
drawer.setSelection(drawer.getDrawerItem(selectedLabel));
|
||||
IDrawerItem selectedDrawerItem = drawer.getDrawerItem(selectedLabel);
|
||||
if (selectedDrawerItem != null) {
|
||||
drawer.setSelection(selectedDrawerItem);
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
@ -395,8 +398,10 @@ public class MainActivity extends AppCompatActivity
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
selectedLabel = (Label) savedInstanceState.getSerializable("selectedLabel");
|
||||
|
||||
drawer.setSelection(drawer.getDrawerItem(selectedLabel));
|
||||
|
||||
IDrawerItem selectedItem = drawer.getDrawerItem(selectedLabel);
|
||||
if (selectedItem != null) {
|
||||
drawer.setSelection(selectedItem);
|
||||
}
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user