From 38f35935581b826940a10246b0a624c643dccc2e Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 4 Apr 2017 09:17:53 +0200
Subject: Test against dialog type instead of nullptr in QtUserSearchWindow

If the dialog is not of type AddContact, firstMultiJIDPage_
is initialised and this states more clearly that the reset
is only done when the dialog is in this mode.

Coverity raised this issue.

Test-Information:

Added a user from search and started a chat from user search.

All unit tests pass on macOS 10.12.4.

Change-Id: I55f6df5b4f48e2c6718922846a424bf17f363b16

diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 7575a13..f150557 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -77,7 +77,7 @@ QtUserSearchWindow::~QtUserSearchWindow() {
 
 void QtUserSearchWindow::handleCurrentChanged(int page) {
     searchNext_ = false;
-    if (firstMultiJIDPage_) {
+    if (type_ != AddContact) {
         firstMultiJIDPage_->reset();
     }
     resultsPage_->emitCompletenessCheck();
@@ -121,7 +121,8 @@ void QtUserSearchWindow::handleCurrentChanged(int page) {
 JID QtUserSearchWindow::getServerToSearch() {
     if (type_ == AddContact) {
         return firstPage_->byRemoteSearch_->isChecked() ? JID(Q2PSTRING(firstPage_->service_->currentText().trimmed())) : myServer_;
-    } else {
+    }
+    else {
         return firstMultiJIDPage_->byRemoteSearch_->isChecked() ? JID(Q2PSTRING(firstMultiJIDPage_->service_->currentText().trimmed())) : myServer_;
     }
 }
-- 
cgit v0.10.2-6-g49f6