goplantuml
                                
                                 goplantuml copied to clipboard
                                
                                    goplantuml copied to clipboard
                            
                            
                            
                        fix(parser): handle empty theType to prevent index out of range error
The code to be modified is below, when theType length is 0, will be panic. https://github.com/jfeliu007/goplantuml/blob/b5960c7507ea6208a0baf28762884329544b7090/parser/class_parser.go#L275-L280
error:
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/jfeliu007/goplantuml/parser.(*ClassParser).handleFuncDecl(0xc00007a0a0, 0xc000167740)
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:279 +0x3cd
github.com/jfeliu007/goplantuml/parser.(*ClassParser).parseFileDeclarations(0xc00007a0a0?, {0x60eae8?, 0xc000167740?})
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:265 +0x72
github.com/jfeliu007/goplantuml/parser.(*ClassParser).parsePackage(0xc00007a0a0, {0x60de20?, 0xc000172ae0})
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:233 +0x353
github.com/jfeliu007/goplantuml/parser.(*ClassParser).parseDirectory(0xc00007a0a0, {0x7ffd1a0c813f, 0x2f})
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:254 +0xd4
github.com/jfeliu007/goplantuml/parser.NewClassDiagramWithOptions.func1({0x7ffd1a0c813f, 0x2f}, {0x60fc08, 0xc00007f2b0}, {0x0?, 0x0?})
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:169 +0x105
github.com/spf13/afero.walk({0x610920, 0x79b860}, {0x7ffd1a0c813f, 0x2f}, {0x60fc08, 0xc00007f2b0}, 0xc00017bc00)
 /Users/ming/Desktop/goplantuml/vendor/github.com/spf13/afero/path.go:44 +0x6c
github.com/spf13/afero.Walk({0x610920, 0x79b860}, {0x7ffd1a0c813f, 0x2f}, 0xc000104c00)
 /Users/ming/Desktop/goplantuml/vendor/github.com/spf13/afero/path.go:105 +0x7a
github.com/jfeliu007/goplantuml/parser.NewClassDiagramWithOptions(0xc00017bc30)
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:158 +0x2d0
github.com/jfeliu007/goplantuml/parser.NewClassDiagram({0xc00002a220?, 0xc000104f00?, 0x8?}, {0x79b860?, 0x0?, 0x1f?}, 0x47?)
 /Users/ming/Desktop/goplantuml/parser/class_parser.go:209 +0x8d
main.main()
 /Users/ming/Desktop/goplantuml/cmd/goplantuml/main.go:102 +0xd69