diff options
author | Johannes Schanda <schanda@itestra.de> | 2013-09-13 17:24:29 +0200 |
---|---|---|
committer | Johannes Schanda <schanda@itestra.de> | 2013-09-13 18:20:59 +0200 |
commit | af283890f1fc388f3dd889df134a6c5fd7526b13 (patch) | |
tree | 897ecf233069a493cff6ae805708bfacc1400a7e | |
parent | 14b1aa5b1e45866bf8d147fdc317867ad75756be (diff) | |
download | genivi-common-api-runtime-af283890f1fc388f3dd889df134a6c5fd7526b13.tar.gz |
Fix seg fault on null pointer in operators
-rw-r--r-- | src/CommonAPI/ContainerUtils.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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<ClientId>& t) const { - return t->hashCode(); + if (t) { + return t->hashCode(); + } else { + return NULL; + } } bool SharedPointerClientIdContentEqual::operator()(const std::shared_ptr<ClientId>& a, const std::shared_ptr<ClientId>& b) const { - return *a==*b; + if (a && b) { + return *a==*b; + } else { + return false; + } } } // namespace std |