Skip to content

Commit

Permalink
Merge pull request #650 from kolen/fix-warning-options-not-initialized
Browse files Browse the repository at this point in the history
Fix "instance variable @options not initialized" warning in verbose mode
  • Loading branch information
robin850 authored Mar 25, 2018
2 parents f4bd88b + 6b86656 commit e23383e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

* Fix `warning: instance variable @options not initialized` when
running under verbose mode (`-w`, `$VERBOSE = true`).

* Fix SmartyPants single quotes right after a link. For example:

~~~markdown
Expand Down
4 changes: 3 additions & 1 deletion ext/redcarpet/rc_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ static VALUE rb_redcarpet_rbase_alloc(VALUE klass)
static void rb_redcarpet__overload(VALUE self, VALUE base_class)
{
struct rb_redcarpet_rndr *rndr;
VALUE options_ivar;

Data_Get_Struct(self, struct rb_redcarpet_rndr, rndr);
rndr->options.self = self;
Expand All @@ -411,7 +412,8 @@ static void rb_redcarpet__overload(VALUE self, VALUE base_class)
}
}

if (rb_iv_get(self, "@options") == Qnil)
options_ivar = rb_attr_get(self, rb_intern("@options"));
if (options_ivar == Qundef || options_ivar == Qnil)
rb_iv_set(self, "@options", rb_hash_new());
}

Expand Down

0 comments on commit e23383e

Please sign in to comment.