From 35161b7b8ab846fb6ae9d6cfa3229d89d214c192 Mon Sep 17 00:00:00 2001 From: Tom Black Date: Mon, 29 Jan 2018 16:11:35 -0800 Subject: Try to add controller mappings only if file exists --- ext/ruby2d/ruby2d.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c index 49beb2c..0b9e338 100644 --- a/ext/ruby2d/ruby2d.c +++ b/ext/ruby2d/ruby2d.c @@ -909,8 +909,11 @@ static R_VAL ruby2d_window_ext_show(R_VAL self) { S2D_Diagnostics(true); } + // Load controller mappings, if DB file exists char *controller_mappings_path = RSTRING_PTR(r_iv_get(self, "@controller_mappings_path")); - S2D_LoadControllerMappingsFromFile(controller_mappings_path); + if (S2D_FileExists(controller_mappings_path)) { + S2D_LoadControllerMappingsFromFile(controller_mappings_path); + } // Get window attributes char *title = RSTRING_PTR(r_iv_get(self, "@title")); -- cgit v1.2.3