From 791a10c9c49d345a6720c1b2abe416c4adbc1533 Mon Sep 17 00:00:00 2001 From: Harald Brinkmann Date: Wed, 8 Mar 2017 21:11:36 +0100 Subject: [PATCH] Sanitize joystick names --- src/m64py/frontend/joystick.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/m64py/frontend/joystick.py b/src/m64py/frontend/joystick.py index 0288371..6eb913c 100644 --- a/src/m64py/frontend/joystick.py +++ b/src/m64py/frontend/joystick.py @@ -73,7 +73,10 @@ class Joystick(QObject): if not SDL_WasInit(SDL_INIT_JOYSTICK): if SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0: for i in range(SDL_NumJoysticks()): - self.joystick_names.append(SDL_JoystickNameForIndex(i)) + joystick_name = SDL_JoystickNameForIndex(i) + if isinstance(joystick_name, bytes): + joystick_name = joystick_name.decode() + self.joystick_names.append(joystick_name.strip()) self.joystick_timer.timeout.connect(self.process_events) else: