From f32c20883e49a6fb8dcbf909986c906918214807 Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Mon, 14 Mar 2022 01:44:16 +0100 Subject: [PATCH] Ignore unknown parameters and log a warning (#730) * Ignore unknown parameters and log a warning * Added comment * Updated logging --- src/raspberrypi/devices/device.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/raspberrypi/devices/device.cpp b/src/raspberrypi/devices/device.cpp index 15b0b69b..98e60f62 100644 --- a/src/raspberrypi/devices/device.cpp +++ b/src/raspberrypi/devices/device.cpp @@ -126,7 +126,13 @@ void Device::SetParams(const unordered_map& params) this->params = GetDefaultParams(); for (const auto& param : params) { - this->params[param.first] = param.second; + // It is assumed that there are default parameters for all supported parameters + if (this->params.find(param.first) != this->params.end()) { + this->params[param.first] = param.second; + } + else { + LOGWARN("%s", string("Ignored unknown parameter '" + param.first + "'").c_str()); + } } }