Skip to content

Crashes on improper nesting #31

@RubenVerborgh

Description

@RubenVerborgh

I accidentally had a structure

## h2
### h3

### h4

where the h3 was not being picked up because of a missing newline before.

It crashed as follows:

NoMethodError: undefined method `[]' for nil:NilClass

    sections_index[@reference_counts[document_sections[0]] - 1][:children][@reference_counts[document_sections[1]] - 1][:children][@reference_counts[document_sections[2]] - 1] = { :name => name, :id => id, :children => [] }
                                                                                                                       ^^^^^^^^^^^

Current item: /index.md.erb (:default representation)

  0. /Users/ruben/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/scholarmarkdown-3.0.0/lib/scholarmarkdown/filter/labelify.rb:98:in `number_for'
  1. ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions