diff options
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 5473823..2f4d2e5 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -15,6 +15,7 @@ #include <QLayout> #include <QTabBar> #include <QApplication> +#include <qdebug.h> namespace Swift { QtChatTabs::QtChatTabs() : QWidget() { @@ -148,7 +149,10 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) { tabs_->tabBar()->setTabTextColor(index, tabTextColor); int unread = 0; for (int i = 0; i < tabs_->count(); i++) { - unread += qobject_cast<QtTabbable*>(tabs_->widget(i))->getCount(); + QtTabbable* tab = qobject_cast<QtTabbable*>(tabs_->widget(i)); + if (tab) { + unread += tab->getCount(); + } } QtTabbable* current = qobject_cast<QtTabbable*>(tabs_->currentWidget()); |