From 659a338d267bc8e1c0c48d51bc9dbdda97596877 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Tue, 5 Jan 2016 23:19:12 -0800 Subject: [PATCH] Avoid crashing if azimuth model is unavailable (shader failed to compile) --- src/video/gltouchjoy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/gltouchjoy.c b/src/video/gltouchjoy.c index b7ebd7fb..f5102add 100644 --- a/src/video/gltouchjoy.c +++ b/src/video/gltouchjoy.c @@ -186,6 +186,9 @@ static void *_rb_create_model(GLModel *parent) { } static void _rb_render(void) { + if (!axes.azimuthModel) { + return; + } GLModelRBJoystick *azimuthJoystick = (GLModelRBJoystick *)axes.azimuthModel->custom; @@ -640,7 +643,7 @@ static inline void _button_touch_down(int x, int y) { static inline void _axis_move(int x, int y) { - if (joyglobals.showAzimuth) { + if (joyglobals.showAzimuth && axes.azimuthModel) { float centerX = 0.f; float centerY = 0.f; glhud_screenToModel(x, y, touchport.width, touchport.height, ¢erX, ¢erY);