From d3d56d3454104cf7436f940f98bcb6448a095bee Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 4 Jan 2018 14:13:04 -0600 Subject: [PATCH] Fixes rare crash when updating connected controllers --- Delta/Emulation/GameViewController.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Delta/Emulation/GameViewController.swift b/Delta/Emulation/GameViewController.swift index 828b8b2..6a12672 100644 --- a/Delta/Emulation/GameViewController.swift +++ b/Delta/Emulation/GameViewController.swift @@ -412,8 +412,11 @@ private extension GameViewController if let emulatorCore = self.emulatorCore, let game = self.game { - let controllers = [self.controllerView as GameController] + ExternalGameControllerManager.shared.connectedControllers - + // Roundabout way of combining arrays to prevent rare runtime crash in + operator :( + var controllers = [GameController]() + controllers.append(self.controllerView) + controllers.append(contentsOf: ExternalGameControllerManager.shared.connectedControllers) + for gameController in controllers { if gameController.playerIndex != nil