summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTom Black <[email protected]>2018-01-29 16:11:35 -0800
committerTom Black <[email protected]>2018-01-29 16:11:35 -0800
commit35161b7b8ab846fb6ae9d6cfa3229d89d214c192 (patch)
tree56a713faa8bd025f71a997ef166b7eeb267efc8c
parent5046526163b1cdf6794ca72a8fe375992d601597 (diff)
downloadruby2d-35161b7b8ab846fb6ae9d6cfa3229d89d214c192.tar.gz
ruby2d-35161b7b8ab846fb6ae9d6cfa3229d89d214c192.zip
Try to add controller mappings only if file exists
-rw-r--r--ext/ruby2d/ruby2d.c5
1 files changed, 4 insertions, 1 deletions
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"));