Skip to content

0.7.0 SIGSEGV #14

Closed
Closed
@ilovezfs

Description

@ilovezfs

This bug is caused by fd65dd8 and goes away if I revert that commit.

Running
gh-md-toc ../README.md crashes.

iMac-TMP:github-markdown-toc.go joe$ /usr/local/Cellar/github-markdown-toc/HEAD-3959e2c/bin/gh-md-toc  ../README.md

Table of Contents
=================

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12ba246]

goroutine 1 [running]:
main.(*GHToc).Print(0x0)
	/private/tmp/github-markdown-toc-20170703-12178-5ub0au/src/github.com/ekalinin/github-markdown-toc.go/main.go:28 +0x26
main.main()
	/private/tmp/github-markdown-toc-20170703-12178-5ub0au/src/github.com/ekalinin/github-markdown-toc.go/main.go:265 +0xa9a
(lldb) r ../README.md
Process 12715 launched: '/usr/local/Cellar/github-markdown-toc/HEAD-3959e2c/bin/gh-md-toc' (x86_64)

Table of Contents
=================

Process 12715 stopped
* thread #1: tid = 0xae9b72, 0x00000000012ba246 gh-md-toc`main.(toc=(len <parent is NULL>, cap <parent is NULL>)).Print + 38 at main.go:28, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000000012ba246 gh-md-toc`main.(toc=(len <parent is NULL>, cap <parent is NULL>)).Print + 38 at main.go:28
(lldb) bt
* thread #1: tid = 0xae9b72, 0x00000000012ba246 gh-md-toc`main.(toc=(len <parent is NULL>, cap <parent is NULL>)).Print + 38 at main.go:28, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000000012ba246 gh-md-toc`main.(toc=(len <parent is NULL>, cap <parent is NULL>)).Print + 38 at main.go:28
    frame #1: 0x00000000012bc1ea gh-md-toc`main.main + 2714 at main.go:265
    frame #2: 0x000000000102bb8a gh-md-toc`runtime.main + 522 at proc.go:185
    frame #3: 0x0000000001054ee1 gh-md-toc`runtime.goexit + 1 at asm_amd64.s:2197
    frame #4: 0x00000000012bc1ea gh-md-toc`main.main + 2714 at main.go:265
    frame #5: 0x000000000102bb8a gh-md-toc`runtime.main + 522 at proc.go:185
    frame #6: 0x0000000001054ee1 gh-md-toc`runtime.goexit + 1 at asm_amd64.s:2197
    frame #7: 0x000000000102bb8a gh-md-toc`runtime.main + 522 at proc.go:185
    frame #8: 0x0000000001054ee1 gh-md-toc`runtime.goexit + 1 at asm_amd64.s:2197
    frame #9: 0x0000000001054ee1 gh-md-toc`runtime.goexit + 1 at asm_amd64.s:2197
(lldb) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions