fix bug for print nil

This commit is contained in:
Star 2024-11-08 16:14:34 +08:00
parent c16c87ee84
commit 3cdc9b628a
2 changed files with 7 additions and 7 deletions

View File

@ -148,7 +148,7 @@ func consolePrint(args goja.FunctionCall, typ string, vm *goja.Runtime) {
bgColor = u.BgRed
}
if len(args.Arguments) == 1 && args.Argument(0).ExportType().Kind() == reflect.Map {
if len(args.Arguments) == 1 && args.Argument(0).ExportType() != nil && args.Argument(0).ExportType().Kind() == reflect.Map {
ex := args.Argument(0).ToObject(vm)
message := ex.Get("message")
stack := ex.Get("stack")

12
go.mod
View File

@ -3,20 +3,20 @@ module apigo.cc/gojs/console
go 1.18
require (
apigo.cc/gojs v0.0.1
github.com/ssgo/u v1.7.9
apigo.cc/gojs v0.0.4
github.com/ssgo/u v1.7.11
)
require (
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
github.com/ssgo/config v1.7.7 // indirect
github.com/ssgo/config v1.7.9 // indirect
github.com/ssgo/log v1.7.7 // indirect
github.com/ssgo/standard v1.7.7 // indirect
github.com/ssgo/tool v0.4.27 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)