From a00ac739893337c0239968abf7ead1f4370d579d Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 2 Jun 2011 13:04:14 +0000 Subject: [PATCH] Ensure that a GetDeviceName() call triggers a ScanDevices() as well, as it can be called without calling CountDevices(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41869 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/device/Joystick.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kits/device/Joystick.cpp b/src/kits/device/Joystick.cpp index f91e0db457..016bfb1ebf 100644 --- a/src/kits/device/Joystick.cpp +++ b/src/kits/device/Joystick.cpp @@ -219,7 +219,8 @@ BJoystick::GetDeviceName(int32 index, char *name, size_t bufSize) if (fDevices == NULL) return B_NO_INIT; - if (index >= fDevices->CountItems()) + // CountDevices() also calls ScanDevices() and therefore updates our list. + if (index >= CountDevices()) return B_BAD_INDEX; if (name == NULL)