Skip to content

Instantly share code, notes, and snippets.

@badosu
Created May 21, 2013 10:03
Show Gist options
  • Save badosu/5618731 to your computer and use it in GitHub Desktop.
Save badosu/5618731 to your computer and use it in GitHub Desktop.
diff --git a/vm/builtin/block_environment.cpp b/vm/builtin/block_environment.cpp
index d603156..ba93f94 100644
--- a/vm/builtin/block_environment.cpp
+++ b/vm/builtin/block_environment.cpp
@@ -149,6 +149,13 @@ namespace rubinius {
if(!(ary = try_as<Array>(obj))) {
if(CBOOL(obj->respond_to(state, G(sym_to_ary), cFalse))) {
obj = obj->send(state, call_frame, G(sym_to_ary));
+ if(!obj) {
+ Exception* exc =
+ as<Exception>(state->vm()->thread_state()->current_exception());
+ exc->locations(state, Location::from_call_stack(state, call_frame));
+ state->raise_exception(exc);
+ return NULL;
+ }
if(!(ary = try_as<Array>(obj))) {
Exception::type_error(state, "to_ary must return an Array", call_frame);
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment