diff options
author | Daniel Lublin <daniel@lublin.se> | 2021-05-04 10:55:36 +0300 |
---|---|---|
committer | Daniel Lublin <daniel@lublin.se> | 2021-05-04 10:55:42 +0300 |
commit | 5ce440e2cba8d17355112bbc1258c944f6553ad3 (patch) | |
tree | 18c1ad879b40142e8093166dccfc4959a80901c0 | |
parent | 5b1a4b6bc24613e4c803b122af85590ac9cd6925 (diff) |
Fix that NullPointerException for real
Honestly don't know what I was doing here last time.
-rw-r--r-- | src/main/java/se/lublin/humla/protocol/ModelHandler.java | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/main/java/se/lublin/humla/protocol/ModelHandler.java b/src/main/java/se/lublin/humla/protocol/ModelHandler.java index b763b7d..9b88d49 100644 --- a/src/main/java/se/lublin/humla/protocol/ModelHandler.java +++ b/src/main/java/se/lublin/humla/protocol/ModelHandler.java @@ -265,22 +265,23 @@ public class ModelHandler extends HumlaTCPMessageListener.Stub { if(msg.hasSelfDeaf()) user.setSelfDeafened(msg.getSelfDeaf()); - Channel selfChan = self.getChannel(); - Channel userChan = user.getChannel(); - if (self != null && user.getSession() != self.getSession() && userChan != null && selfChan != null && userChan.equals(selfChan)) { - if(user.isSelfMuted() && user.isSelfDeafened()) - mLogger.logInfo(mContext.getString(R.string.chat_notify_now_muted_deafened, MessageFormatter.highlightString(user.getName()))); - else if(user.isSelfMuted()) - mLogger.logInfo(mContext.getString(R.string.chat_notify_now_muted, MessageFormatter.highlightString(user.getName()))); - else - mLogger.logInfo(mContext.getString(R.string.chat_notify_now_unmuted, MessageFormatter.highlightString(user.getName()))); - } else if(self != null && user.getSession() == self.getSession()) { - if(user.isSelfMuted() && user.isSelfDeafened()) - mLogger.logInfo(mContext.getString(R.string.chat_notify_muted_deafened)); - else if(user.isSelfMuted()) - mLogger.logInfo(mContext.getString(R.string.chat_notify_muted)); - else - mLogger.logInfo(mContext.getString(R.string.chat_notify_unmuted)); + if (self != null) { + Channel userChan = user.getChannel(); + if (user.getSession() != self.getSession() && userChan != null && userChan.equals(self.getChannel())) { + if (user.isSelfMuted() && user.isSelfDeafened()) + mLogger.logInfo(mContext.getString(R.string.chat_notify_now_muted_deafened, MessageFormatter.highlightString(user.getName()))); + else if (user.isSelfMuted()) + mLogger.logInfo(mContext.getString(R.string.chat_notify_now_muted, MessageFormatter.highlightString(user.getName()))); + else + mLogger.logInfo(mContext.getString(R.string.chat_notify_now_unmuted, MessageFormatter.highlightString(user.getName()))); + } else if (user.getSession() == self.getSession()) { + if (user.isSelfMuted() && user.isSelfDeafened()) + mLogger.logInfo(mContext.getString(R.string.chat_notify_muted_deafened)); + else if (user.isSelfMuted()) + mLogger.logInfo(mContext.getString(R.string.chat_notify_muted)); + else + mLogger.logInfo(mContext.getString(R.string.chat_notify_unmuted)); + } } } |