summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schanda <schanda@itestra.de>2013-09-13 17:24:29 +0200
committerJohannes Schanda <schanda@itestra.de>2013-09-13 18:20:59 +0200
commitaf283890f1fc388f3dd889df134a6c5fd7526b13 (patch)
tree897ecf233069a493cff6ae805708bfacc1400a7e
parent14b1aa5b1e45866bf8d147fdc317867ad75756be (diff)
downloadgenivi-common-api-runtime-af283890f1fc388f3dd889df134a6c5fd7526b13.tar.gz
Fix seg fault on null pointer in operators
-rw-r--r--src/CommonAPI/ContainerUtils.cpp12
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