From 3a29385df0414183bb7c6d850865eac1d0db7558 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 13 Sep 2014 02:54:44 +0200 Subject: [PATCH] MRI: load_data: Catch exceptions and pass onto ruby --- binding-mri/filesystem-binding.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index 8ff531e..050f25c 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -43,7 +43,16 @@ static VALUE fileIntForPath(const char *path) { SDL_RWops *ops = SDL_AllocRW(); - shState->fileSystem().openRead(*ops, path); + + try + { + shState->fileSystem().openRead(*ops, path); + } + catch (const Exception &e) + { + SDL_FreeRW(ops); + raiseRbExc(e); + } VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));