summaryrefslogtreecommitdiff
path: root/src/libcamera/yaml_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/yaml_parser.cpp')
-rw-r--r--src/libcamera/yaml_parser.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
index bf21141e..aac9a2bd 100644
--- a/src/libcamera/yaml_parser.cpp
+++ b/src/libcamera/yaml_parser.cpp
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2022, Google Inc.
*
- * yaml_parser.cpp - libcamera YAML parsing helper
+ * libcamera YAML parsing helper
*/
#include "libcamera/internal/yaml_parser.h"
@@ -468,10 +468,13 @@ bool YamlObject::contains(const std::string &key) const
*/
const YamlObject &YamlObject::operator[](const std::string &key) const
{
- if (type_ != Type::Dictionary || !contains(key))
+ if (type_ != Type::Dictionary)
return empty;
auto iter = dictionary_.find(key);
+ if (iter == dictionary_.end())
+ return empty;
+
return *iter->second;
}