[retro-gtk] environment: Don't set unkown rotations



commit 2a5babc2d6c9df678aa491b56342e1ecb8ce8847
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Dec 17 19:33:53 2020 +0100

    environment: Don't set unkown rotations
    
    Instead log the critical error and return the failure.

 retro-runner/retro-environment.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/retro-runner/retro-environment.c b/retro-runner/retro-environment.c
index efb45db..fdb17e3 100644
--- a/retro-runner/retro-environment.c
+++ b/retro-runner/retro-environment.c
@@ -427,6 +427,12 @@ static gboolean
 set_rotation (RetroCore           *self,
               const RetroRotation *rotation)
 {
+  if (G_UNLIKELY (*rotation >= CLOCKWISE)) {
+    g_critical ("Couldn't set unknown rotation %d", *rotation);
+
+    return FALSE;
+  }
+
   self->rotation = *rotation;
 
   return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]