Commit f10ec204 authored by Romain Bertozzi's avatar Romain Bertozzi
Browse files

smartlist: prevent npe after a qrcode scan

This patch prevents some npes to occur after scanning a qrcode. These
crashes occured when the smartlistfragment was destroyed. Its state
wasn't properly restored when accessing resources.

Change-Id: I22f10af2b12a487d3c941818f35dcf0d55f0666d
Tuleap: #862
parent 6d3d271e
......@@ -289,7 +289,9 @@ public class SmartListFragment extends Fragment implements SearchView.OnQueryTex
mFloatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSearchMenuItem.expandActionView();
if (mSearchMenuItem != null) {
mSearchMenuItem.expandActionView();
}
}
});
......@@ -347,7 +349,9 @@ public class SmartListFragment extends Fragment implements SearchView.OnQueryTex
}
private void startConversation(CallContact c) {
mSearchMenuItem.collapseActionView();
if (mSearchMenuItem != null) {
mSearchMenuItem.collapseActionView();
}
Intent intent = new Intent()
.setClass(getActivity(), ConversationActivity.class)
......@@ -578,17 +582,16 @@ public class SmartListFragment extends Fragment implements SearchView.OnQueryTex
true,
R.drawable.ic_settings_white_48dp,
new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = getActivity();
if (activity != null && activity instanceof HomeActivity) {
HomeActivity homeActivity = (HomeActivity)activity;
homeActivity.goToSettings();
}
}
});
}
else {
@Override
public void onClick(View v) {
Activity activity = getActivity();
if (activity != null && activity instanceof HomeActivity) {
HomeActivity homeActivity = (HomeActivity) activity;
homeActivity.goToSettings();
}
}
});
} else {
this.showErrorPanel(R.string.error_no_network, false, 0, null);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment