From b7fa67654681b646ee7f3754a609954815cf2ec4 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 23 Sep 2016 12:54:27 +0200 Subject: [PATCH] linux-dist/evdev: Use std::Map.find() instead of operator[] Since EvdevControllerMapping does not have a default constructor, we can't use the operator[]; data_type& operator[](const key_type& k) - Returns a reference to the object that is associated with a particular key. If the map does not already contain such an object, operator[] inserts the default object data_type(). Instead, we use the std::map.find() function. This should resolve #971. --- core/linux-dist/evdev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/linux-dist/evdev.cpp b/core/linux-dist/evdev.cpp index 09dd3ddca..2e75f9811 100644 --- a/core/linux-dist/evdev.cpp +++ b/core/linux-dist/evdev.cpp @@ -285,7 +285,7 @@ return -3; } } - controller->mapping = &loaded_mappings[string(mapping_fname)]; + controller->mapping = &loaded_mappings.find(string(mapping_fname))->second; printf("evdev: Using '%s' mapping\n", controller->mapping->name); controller->init();