From fe92cc9dfbcde566ba2ac9af23e6774942c856cb Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 6 Mar 2017 12:08:33 +0100
Subject: Fix emoji dialog crash when there are no recent emojis

The dialog would crash if the user has not selected an emoji
ever before through the dialog.

Test-Information:

Cleared recent list and opened the dialog. Without this patch
it would crash, since there are no items in the emojiLayout.
Now it does not crash anymore, on macOS 10.12.3 with Qt 5.5.1.

Change-Id: Ie736b5af7fe8b2b2c14fcac94b7e4f3bc13f4b84

diff --git a/Swift/QtUI/QtEmojisScroll.cpp b/Swift/QtUI/QtEmojisScroll.cpp
index 27963a1..2c347bb 100644
--- a/Swift/QtUI/QtEmojisScroll.cpp
+++ b/Swift/QtUI/QtEmojisScroll.cpp
@@ -24,6 +24,9 @@ namespace Swift {
         this->setLayout(new QVBoxLayout);
         this->layout()->addWidget(scrollArea);
         this->layout()->setContentsMargins(0,0,0,0);
-        setMinimumHeight(emojiLayout->itemAt(0)->minimumSize().height() * 8);
+
+        if (emojiLayout->itemAt(0)) {
+            setMinimumHeight(emojiLayout->itemAt(0)->minimumSize().height() * 8);
+        }
     }
 }
-- 
cgit v0.10.2-6-g49f6