summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-10 03:02:31 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-10 03:37:40 +0100
commit162b66f62312280d06b454496804a0956a06fa35 (patch)
treef93c313da9084338728761d9b1cfe5710041127d /options
parentfefff49d13f765c249a2419309ed16a8b425df66 (diff)
options/value: don't do tree lookup twice
Diffstat (limited to 'options')
-rw-r--r--options/value.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/options/value.hpp b/options/value.hpp
index 37a2f317..1da1dd9c 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -48,10 +48,12 @@ class value final : public base_value
if (self_name.isEmpty())
return def;
- if (!b->contains(self_name) || b->get<QVariant>(self_name).type() == QVariant::Invalid)
+ QVariant variant = b->get<QVariant>(self_name);
+
+ if (!b->contains(self_name) || variant.type() == QVariant::Invalid)
return def;
- const element_type x(b->get<element_type>(self_name));
+ const element_type x(variant.value<element_type>());
return traits::from_value(traits::from_storage(x), def);
}