forked from TrueCloudLab/neoneo-go
Merge pull request #2645 from nspcc-dev/fix-vm-cli-panic
compiler: avoid panic on empty package list
This commit is contained in:
commit
ab577da2b5
1 changed files with 3 additions and 0 deletions
|
@ -2185,6 +2185,9 @@ func newCodegen(info *buildInfo, pkg *packages.Package) *codegen {
|
||||||
|
|
||||||
// codeGen compiles the program to bytecode.
|
// codeGen compiles the program to bytecode.
|
||||||
func codeGen(info *buildInfo) (*nef.File, *DebugInfo, error) {
|
func codeGen(info *buildInfo) (*nef.File, *DebugInfo, error) {
|
||||||
|
if len(info.program) == 0 {
|
||||||
|
return nil, nil, errors.New("empty package")
|
||||||
|
}
|
||||||
pkg := info.program[0]
|
pkg := info.program[0]
|
||||||
c := newCodegen(info, pkg)
|
c := newCodegen(info, pkg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue