From a32bb8f1b9015c80f859b6a8e72695375eb89977 Mon Sep 17 00:00:00 2001
From: Scott Mansell <phiren@gmail.com>
Date: Sat, 3 Sep 2016 14:08:10 +1200
Subject: [PATCH] Movie: Fix null pointer derefrence.

Part of the acceleration data is packed in with the buttons. We
always have button data when we have acceleration data.
---
 Source/Core/Core/Movie.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp
index c32ead6fa6..03ea3f55c3 100644
--- a/Source/Core/Core/Movie.cpp
+++ b/Source/Core/Core/Movie.cpp
@@ -772,15 +772,15 @@ static void SetWiiInputDisplayString(int remoteID, u8* const data,
       display_str += " 2";
     if (buttons.home)
       display_str += " HOME";
-  }
 
-  if (accelData)
-  {
-    wm_accel* dt = (wm_accel*)accelData;
-    display_str +=
-        StringFromFormat(" ACC:%d,%d,%d", dt->x << 2 | ((wm_buttons*)coreData)->acc_x_lsb,
-                         dt->y << 2 | ((wm_buttons*)coreData)->acc_y_lsb << 1,
-                         dt->z << 2 | ((wm_buttons*)coreData)->acc_z_lsb << 1);
+    // A few bits of accelData are actually inside the coreData struct.
+    if (accelData)
+    {
+      wm_accel* dt = (wm_accel*)accelData;
+      display_str += StringFromFormat(" ACC:%d,%d,%d", dt->x << 2 | buttons.acc_x_lsb,
+                                      dt->y << 2 | buttons.acc_y_lsb << 1,
+                                      dt->z << 2 | buttons.acc_z_lsb << 1);
+    }
   }
 
   if (irData)