ports/net-im/ktp-common-internals/files/patch-KTp__Logger__plugins__tplogger__pending-tp-logger-logs.cpp
Alonso Schaich 36cf982eec Update telepathy to 0.8.0
Merge area51's commits 10180, 10181, 10314, 10315, 10485, 10491, 10492,
10500, 10502, 10503 and 10504. Individual revisions can be reviewed at
http://src.mouf.net/area51/log

This commit is based on a patch originally sent to the kde@ mailing list by
T.C.Berner <tcberner@gmail.com>, and introduces a new port for
ktp-desktop-applets.

Approved by:		rakuco (mentor)
Differential Revision:	https://reviews.freebsd.org/D1264
2014-12-16 10:26:19 +00:00

41 lines
1.6 KiB
C++

commit 60452d2718f1b5a910dad64d6360d600d4107642
Author: Dan Vrátil <dvratil@redhat.com>
Date: Thu Apr 10 21:08:59 2014 +0200
Fix build (sorry!)
commit ccd4d133ba4becb7c8662eb3e57612e8aa9773e4
Author: Dan Vrátil <dvratil@redhat.com>
Date: Thu Apr 10 20:58:47 2014 +0200
Don't crash when TelepathyLoggerQt4 returns a null TextEvent
Tpl::PendingEvents sometimes returns a list of events that includes a null
event, which leads to a crash when we try to dereference it (either by
hitting an assert in QtGlib, or by calling methods on a null pointer).
BUG: 331104
FIXED-IN: 0.8.1
--- KTp/Logger/plugins/tplogger/pending-tp-logger-logs.cpp
+++ KTp/Logger/plugins/tplogger/pending-tp-logger-logs.cpp
@@ -28,6 +28,8 @@
#include <KTp/message-processor.h>
+#include <KDebug>
+
PendingTpLoggerLogs::PendingTpLoggerLogs(const Tp::AccountPtr &account,
const KTp::LogEntity &entity,
const QDate &date,
@@ -60,6 +62,11 @@ void PendingTpLoggerLogs::logsRetrieved(Tpl::PendingOperation *op)
QList<KTp::LogMessage> logs;
Q_FOREACH (const Tpl::EventPtr &event, events) {
const Tpl::TextEventPtr textEvent = event.dynamicCast<Tpl::TextEvent>();
+ if (textEvent.isNull()) {
+ kDebug() << "Received a null TextEvent!";
+ continue;
+ }
+
logs << KTp::LogMessage(Utils::fromTplEntity(event->sender()),
account(), event->timestamp(), textEvent->message(),
textEvent->messageToken());