aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <[email protected]>2017-05-12 17:32:23 -0400
committerAllen Winter <[email protected]>2017-05-12 17:34:02 -0400
commit259daa808e24485e997c77a76232a610037264d4 (patch)
tree4db6daf9693de24862cf3b53e68f848600300e32
parent7f95f4f19586b8c74ab1c7bbb6c471926e27f945 (diff)
src/icaldrag.cpp - don't crash if QMimeData is null
-rw-r--r--src/icaldrag.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/icaldrag.cpp b/src/icaldrag.cpp
index 5ecaade..004107c 100644
--- a/src/icaldrag.cpp
+++ b/src/icaldrag.cpp
@@ -21,11 +21,11 @@
*/
#include "icaldrag.h"
-#include <kcalcore/icalformat.h>
+#include "kcalcore/icalformat.h"
using namespace KCalCore;
-#include <QtCore/QMimeData>
-#include <QtCore/QString>
+#include <QMimeData>
+#include <QString>
using namespace KCalUtils;
using namespace ICalDrag;
@@ -40,7 +40,7 @@ bool ICalDrag::populateMimeData(QMimeData *me, const MemoryCalendar::Ptr &cal)
ICalFormat icf;
QString scal = icf.toString(cal, QString(), false);
- if (scal.length() > 0) {
+ if (me && scal.length() > 0) {
me->setData(mimeType(), scal.toUtf8());
}
return canDecode(me);
@@ -48,7 +48,11 @@ bool ICalDrag::populateMimeData(QMimeData *me, const MemoryCalendar::Ptr &cal)
bool ICalDrag::canDecode(const QMimeData *me)
{
- return me->hasFormat(mimeType());
+ if (me) {
+ return me->hasFormat(mimeType());
+ } else {
+ return false;
+ }
}
bool ICalDrag::fromMimeData(const QMimeData *de, const MemoryCalendar::Ptr &cal)