summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-12-19 21:00:05 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-12-19 21:00:05 +0100
commitc6fea80951c4ab8c9247866ceb4233299a8c6a84 (patch)
tree527a2f41bef6d610f0e1faed2ff864ee4a94fd19 /document
parenta5760e9537aee7fd123e1455424b1083d6881ee8 (diff)
Do not follow the nullptr.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/select/context.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/document/src/vespa/document/select/context.cpp b/document/src/vespa/document/select/context.cpp
index 6d9e0df157b..3a728db33f8 100644
--- a/document/src/vespa/document/select/context.cpp
+++ b/document/src/vespa/document/select/context.cpp
@@ -38,10 +38,14 @@ Context::~Context() { }
std::unique_ptr<Value>
Context::getValue(const vespalib::string & value) const {
- VariableMap::const_iterator iter = _variables->find(value);
-
- if (iter != _variables->end()) {
- return std::make_unique<FloatValue>(iter->second);
+ if (_variables) {
+ VariableMap::const_iterator iter = _variables->find(value);
+
+ if (iter != _variables->end()) {
+ return std::make_unique<FloatValue>(iter->second);
+ } else {
+ return std::make_unique<FloatValue>(0.0);
+ }
} else {
return std::make_unique<FloatValue>(0.0);
}