Fix crash in addMessage
avoids crashing here:
==88313==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x7f6475e32962 bp 0x7ffedf694130 sp 0x7ffedf694110 T0)
==88313==The signal is caused by a READ memory access.
==88313==Hint: address points to the zero page.
#0 0x7f6475e32962 in QVector<Message>::isEmpty() const /usr/include/qt/QtCore/qvector.h:90:42
#1 0x7f6475e2580a in MessageModel::addMessages(QVector<Message> const&, bool) src/core/model/messagemodel.cpp:222:22
#2 0x7f6476083b62 in RocketChatAccount::addMessage(QJsonObject const&, bool, bool) src/core/rocketchataccount.cpp:2603:23
#3 0x7f64760681b1 in RocketChatAccount::slotPostMessageDone(QJsonObject const&) src/core/rocketchataccount.cpp:2574:5
#4 0x7f647601bd74 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QJsonObject const&>, void, void (RocketChatAccount::*)(QJsonObject const&)>::call(void (RocketChatAccount::*)(QJsonObject const&), RocketChatAccount*, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:152:13
#5 0x7f647601bab4 in void QtPrivate::FunctionPointer<void (RocketChatAccount::*)(QJsonObject const&)>::call<QtPrivate::List<QJsonObject const&>, void>(void (RocketChatAccount::*)(QJsonObject const&), RocketChatAccount*, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:185:13
#6 0x7f647601b6f1 in QtPrivate::QSlotObject<void (RocketChatAccount::*)(QJsonObject const&), QtPrivate::List<QJsonObject const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt/QtCore/qobjectdefs_impl.h:418:17
#7 0x7f64731d59d2 (/usr/lib/libQt5Core.so.5+0x2bd9d2)
#8 0x7f64751b9de3 in RocketChatRestApi::Connection::postMessageDone(QJsonObject const&) local/src/rocketchatrestapi-qt5/librocketchatrestapi-qt5_autogen/EWIEGA46WW/moc_connection.cpp:1652:5
#9 0x7f6475235054 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QJsonObject const&>, void, void (RocketChatRestApi::Connection::*)(QJsonObject const&)>::call(void (RocketChatRestApi::Connection::*)(QJsonObject const&), RocketChatRestApi::Connection*, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:152:13
#10 0x7f6475234d94 in void QtPrivate::FunctionPointer<void (RocketChatRestApi::Connection::*)(QJsonObject const&)>::call<QtPrivate::List<QJsonObject const&>, void>(void (RocketChatRestApi::Connection::*)(QJsonObject const&), RocketChatRestApi::Connection*, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:185:13
#11 0x7f64752349d1 in QtPrivate::QSlotObject<void (RocketChatRestApi::Connection::*)(QJsonObject const&), QtPrivate::List<QJsonObject const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt/QtCore/qobjectdefs_impl.h:418:17
#12 0x7f64731d59d2 (/usr/lib/libQt5Core.so.5+0x2bd9d2)
#13 0x7f64751a9940 in RocketChatRestApi::PostMessageJob::postMessageDone(QJsonObject const&) local/src/rocketchatrestapi-qt5/librocketchatrestapi-qt5_autogen/7P2QP2PWIP/moc_postmessagejob.cpp:133:5
#14 0x7f64752ddb7c in RocketChatRestApi::PostMessageJob::onPostRequestResponse(QJsonDocument const&) src/rocketchatrestapi-qt5/chat/postmessagejob.cpp:45:16
#15 0x7f64752717b6 in RocketChatRestApi::RestApiAbstractJob::genericResponseHandler(void (RocketChatRestApi::RestApiAbstractJob::*)(QJsonDocument const&)) src/rocketchatrestapi-qt5/restapiabstractjob.cpp:467:9
#16 0x7f6475275ec9 in RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10::operator()() const src/rocketchatrestapi-qt5/restapiabstractjob.cpp:526:9
#17 0x7f6475275cc6 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10>::call(RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10&, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:146:13
#18 0x7f6475275bf0 in void QtPrivate::Functor<RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10, 0>::call<QtPrivate::List<>, void>(RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10&, void*, void**) /usr/include/qt/QtCore/qobjectdefs_impl.h:256:13
#19 0x7f6475275b90 in QtPrivate::QFunctorSlotObject<RocketChatRestApi::RestApiAbstractJob::submitPostRequest(QJsonDocument const&)::$_10, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt/QtCore/qobjectdefs_impl.h:443:17
#20 0x7f64731d59d2 (/usr/lib/libQt5Core.so.5+0x2bd9d2)
#21 0x7f6474946f47 (/usr/lib/libQt5Network.so.5+0xa2f47)
#22 0x7f64731c8dc5 in QObject::event(QEvent*) (/usr/lib/libQt5Core.so.5+0x2b0dc5)
#23 0x7f6473c2f1a5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x1791a5)
#24 0x7f64731a4b99 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/libQt5Core.so.5+0x28cb99)
#25 0x7f64731a5698 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (/usr/lib/libQt5Core.so.5+0x28d698)
#26 0x7f64731ecbd7 (/usr/lib/libQt5Core.so.5+0x2d4bd7)
#27 0x7f64755d1f12 in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x54f12)
#28 0x7f64756280d8 (/usr/lib/libglib-2.0.so.0+0xab0d8)
#29 0x7f64755cf484 in g_main_context_iteration (/usr/lib/libglib-2.0.so.0+0x52484)
#30 0x7f64731f0ad9 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/libQt5Core.so.5+0x2d8ad9)
#31 0x7f647319ce6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/libQt5Core.so.5+0x284e6a)
#32 0x7f64731a85c6 in QCoreApplication::exec() (/usr/lib/libQt5Core.so.5+0x2905c6)
#33 0x30bf53 in main src/apps/widget/main.cpp:131:21
#34 0x7f6472a1030f in __libc_start_call_main libc-start.c
#35 0x7f6472a103c0 in __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d3c0)
#36 0x259624 in _start (local/bin/ruqola+0x259624)
Edited by Waqar Ahmed