MRI: load_data: Catch exceptions and pass onto ruby

This commit is contained in:
Jonas Kulla 2014-09-13 02:54:44 +02:00
parent 05041fdb03
commit 3a29385df0
1 changed files with 10 additions and 1 deletions

View File

@ -43,7 +43,16 @@ static VALUE
fileIntForPath(const char *path) fileIntForPath(const char *path)
{ {
SDL_RWops *ops = SDL_AllocRW(); SDL_RWops *ops = SDL_AllocRW();
try
{
shState->fileSystem().openRead(*ops, path); shState->fileSystem().openRead(*ops, path);
}
catch (const Exception &e)
{
SDL_FreeRW(ops);
raiseRbExc(e);
}
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt")); VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));