From 9c22a2c8d4cb3d7c55efd03c393fbd59772f5ae3 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 30 Mar 2024 19:43:30 +0100 Subject: [PATCH] Added check that the button is not duplicated in the same row --- src/devices/keyboard-joypad/KeyboardJoypad.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/devices/keyboard-joypad/KeyboardJoypad.cpp b/src/devices/keyboard-joypad/KeyboardJoypad.cpp index 3d71cda..ab0f128 100644 --- a/src/devices/keyboard-joypad/KeyboardJoypad.cpp +++ b/src/devices/keyboard-joypad/KeyboardJoypad.cpp @@ -415,6 +415,11 @@ class yarp::dev::KeyboardJoypad::Impl col = 0; } newButton.col = col++; + if (buttons.first.back().find(alias) != buttons.first.back().end()) + { + yCError(KEYBOARDJOYPAD) << "The alias" << alias << "is already present in the buttons list in the same row."; + return false; + } buttons.first.back()[alias] = newButton; }