aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-14 08:33:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-14 08:33:14 +0000
commitf6e7e11c4aafe4d9877fad06ad5ab016cb7045bb (patch)
tree1ff5c0596bb83031b829791e91896f40adeee4c2 /error.c
parent9e0790b39a88c4429ee32b560688331459516366 (diff)
downloadruby-f6e7e11c4aafe4d9877fad06ad5ab016cb7045bb.tar.gz
error.c: check redefined backtrace result
* error.c (rb_get_backtrace): check the result of `backtrace` even if the method is redefined. [ruby-core:87013] [Bug #14756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/error.c b/error.c
index 92c35d5d67..85d9581689 100644
--- a/error.c
+++ b/error.c
@@ -1162,19 +1162,21 @@ VALUE
rb_get_backtrace(VALUE exc)
{
ID mid = id_backtrace;
+ VALUE info;
if (rb_method_basic_definition_p(CLASS_OF(exc), id_backtrace)) {
- VALUE info, klass = rb_eException;
+ VALUE klass = rb_eException;
rb_execution_context_t *ec = GET_EC();
if (NIL_P(exc))
return Qnil;
EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_CALL, exc, mid, mid, klass, Qundef);
info = exc_backtrace(exc);
EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, exc, mid, mid, klass, info);
- if (NIL_P(info))
- return Qnil;
- return rb_check_backtrace(info);
}
- return rb_funcallv(exc, mid, 0, 0);
+ else {
+ info = rb_funcallv(exc, mid, 0, 0);
+ }
+ if (NIL_P(info)) return Qnil;
+ return rb_check_backtrace(info);
}
/*