From af283890f1fc388f3dd889df134a6c5fd7526b13 Mon Sep 17 00:00:00 2001 From: Johannes Schanda Date: Fri, 13 Sep 2013 17:24:29 +0200 Subject: Fix seg fault on null pointer in operators --- src/CommonAPI/ContainerUtils.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/CommonAPI/ContainerUtils.cpp b/src/CommonAPI/ContainerUtils.cpp index bb1a360..cfe6914 100644 --- a/src/CommonAPI/ContainerUtils.cpp +++ b/src/CommonAPI/ContainerUtils.cpp @@ -11,11 +11,19 @@ namespace CommonAPI { size_t SharedPointerClientIdContentHash::operator()(const std::shared_ptr& t) const { - return t->hashCode(); + if (t) { + return t->hashCode(); + } else { + return NULL; + } } bool SharedPointerClientIdContentEqual::operator()(const std::shared_ptr& a, const std::shared_ptr& b) const { - return *a==*b; + if (a && b) { + return *a==*b; + } else { + return false; + } } } // namespace std -- cgit v1.2.1