Skip to content

Commit c549cb4

Browse files
fix possible duplication of newly added joysticks
1 parent 9c9880f commit c549cb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

code/io/joy-sdl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ bool device_event_handler(const SDL_Event &evt)
483483

484484
for (auto iter = joysticks.begin(); iter != joysticks.end(); ++iter)
485485
{
486-
if ((*iter)->getID() == added->getID())
486+
// must use GUID here as joystick IDs are never reused
487+
if ((*iter)->getGUID() == added->getGUID())
487488
{
488489
// Already have this stick
489490
*(*iter) = std::move(*added);

0 commit comments

Comments
 (0)