From 4a527cfe3d4b5328715ffbcfdb897038df1b439d Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Thu, 12 Dec 2024 08:17:35 +1100 Subject: [PATCH] Fixed panic when typed array is empty --- repl/evaldisplay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repl/evaldisplay.go b/repl/evaldisplay.go index f32ae5b..f4e72d8 100644 --- a/repl/evaldisplay.go +++ b/repl/evaldisplay.go @@ -89,7 +89,7 @@ func (r *REPL) displayResult(ctx context.Context, w io.Writer, res any, concise fmt.Fprintf(w, "]") } else { // In the off-chance that this is actually a slice of printables - vt := reflect.SliceOf(reflect.TypeOf(v[0])) + vt := reflect.ValueOf(res).Type() if tp, ok := r.typePrinters[vt]; ok { canDisplay := true