diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 368144d6d00fa3c087ab01716f18af8ccc53c166..8c1b13c47af575bbdb5437bed844b1516383e73b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,9 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 
+if(POLICY CMP0022)
+   cmake_policy(SET CMP0022 NEW)
+endif(POLICY CMP0022)
+
 INCLUDE(GNUInstallDirs)
 
 ADD_DEFINITIONS("-std=c++0x")
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index 4bb1f3a0cc743f4efa93460c4b925ae0d9565169..c6dd9e56f69d2e262479ed43606105b9ae5fc0c4 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -236,8 +236,11 @@ bool ContactModel::addContact(Contact* c)
 
    //Deprecate the placeholder
    if (m_hPlaceholders.contains(c->uid())) {
-      m_hPlaceholders[c->uid()]->merge(c);
-      m_hPlaceholders[c->uid()] = nullptr;
+      Contact* c2 = m_hPlaceholders[c->uid()];
+      if (c2) {
+         c2->merge(c);
+         m_hPlaceholders[c->uid()] = nullptr;
+      }
    }
    endInsertRows();
    emit layoutChanged();