diff options
author | Tobias Markmann <tm@ayena.de> | 2017-03-28 14:13:00 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2017-03-29 07:11:49 (GMT) |
commit | cd23d0d8a01583b7a5289821c27372ef9f6443e1 (patch) | |
tree | 0633e55b73ed0012abbe0ab80d4cb163db9973cf | |
parent | 0e503ccd97ca5287a14d3147b0deaa99892ccd6f (diff) | |
download | swift-cd23d0d8a01583b7a5289821c27372ef9f6443e1.zip swift-cd23d0d8a01583b7a5289821c27372ef9f6443e1.tar.bz2 |
Remove nullptr checks that are not needed
One must pass a valid AvatarManager instance to the
MUCController. Asserted the fact at the beginning of the actor.
Coverity raised this issue.
Test-Information:
All unit tests pass on macOS 10.12.4 and Swift client can
join MUC conversations without crashing or other noticeable
issues.
Change-Id: Ibc643f907a31fd1253c63c9a4cef79407d1f96ec
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index b673bfd..e65bfa6 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -7,6 +7,7 @@ #include <Swift/Controllers/Chat/MUCController.h> #include <algorithm> +#include <cassert> #include <memory> #include <boost/bind.hpp> @@ -99,6 +100,8 @@ MUCController::MUCController ( VCardManager* vcardManager, MUCBookmarkManager* mucBookmarkManager) : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), nickResolver, presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory, entityCapsProvider, historyController, mucRegistry, highlightManager, chatMessageParser, autoAcceptMUCInviteDecider), muc_(muc), nick_(nick), desiredNick_(nick), password_(password), renameCounter_(0), isImpromptu_(isImpromptu), isImpromptuAlreadyConfigured_(false), clientBlockListManager_(clientBlockListManager), mucBookmarkManager_(mucBookmarkManager) { + assert(avatarManager_); + parting_ = true; joined_ = false; lastWasPresence_ = false; @@ -156,9 +159,8 @@ MUCController::MUCController ( if (stanzaChannel->isAvailable()) { MUCController::setOnline(true); } - if (avatarManager_ != nullptr) { - avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1))); - } + avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1))); + MUCController::handleBareJIDCapsChanged(muc->getJID()); eventStream_->onUIEvent.connect(boost::bind(&MUCController::handleUIEvent, this, _1)); @@ -465,9 +467,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { onActivity(""); } } - if (avatarManager_ != nullptr) { - handleAvatarChanged(jid); - } + handleAvatarChanged(jid); } void MUCController::addPresenceMessage(const std::string& message) { @@ -796,9 +796,7 @@ void MUCController::handleOccupantNicknameChanged(const std::string& oldNickname std::string groupName(roleToGroupName(role)); roster_->addContact(newJID, realJID, newNickname, groupName, avatarManager_->getAvatarPath(newJID)); roster_->applyOnItems(SetMUC(newJID, role, affiliation)); - if (avatarManager_ != nullptr) { - handleAvatarChanged(newJID); - } + handleAvatarChanged(newJID); clearPresenceQueue(); onUserNicknameChanged(oldNickname, newNickname); |