From eb6bfcae1e4592fc4150865c06364858177a387e Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Mon, 15 Sep 2014 17:22:38 +0200
Subject: [PATCH] Fix regression introduced last week

---
 src/CMakeLists.txt   | 4 ++++
 src/contactmodel.cpp | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 368144d6..8c1b13c4 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 4bb1f3a0..c6dd9e56 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();
-- 
GitLab