Skip to content

Commit

Permalink
Check for context (fix #965)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Feb 22, 2017
1 parent 3e37f09 commit f43304f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions app/src/main/java/org/kontalk/ui/AbstractComposeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -1958,18 +1958,20 @@ protected void updateUI() {

if (mToggleEncryptionMenu != null) {
Context context = getActivity();
if (mConversation != null && Preferences.getEncryptionEnabled(context)) {
boolean encryption = mConversation.isEncryptionEnabled();
mToggleEncryptionMenu
.setVisible(true)
.setEnabled(true)
.setChecked(encryption);
}
else {
mToggleEncryptionMenu
.setVisible(false)
.setEnabled(false)
.setChecked(false);
if (context != null) {
if (mConversation != null && Preferences.getEncryptionEnabled(context)) {
boolean encryption = mConversation.isEncryptionEnabled();
mToggleEncryptionMenu
.setVisible(true)
.setEnabled(true)
.setChecked(encryption);
}
else {
mToggleEncryptionMenu
.setVisible(false)
.setEnabled(false)
.setChecked(false);
}
}
}
}
Expand Down

0 comments on commit f43304f

Please sign in to comment.