You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2021/04/14 13:20:56 UTC

[plc4x] 06/14: plc4go: when we try to box reflect.nil we just return an empty string

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 8c67dd1a23e94d55a550fc1055db8793b829fbae
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Apr 14 08:01:53 2021 +0200

    plc4go: when we try to box reflect.nil we just return an empty string
---
 plc4go/internal/plc4go/spi/utils/asciiBox.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox.go b/plc4go/internal/plc4go/spi/utils/asciiBox.go
index 698369a..918f32a 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox.go
@@ -68,6 +68,9 @@ func BoxAnything(name string, anything interface{}, charWidth int) AsciiBox {
 		return BoxString(name, anything.(fmt.Stringer).String(), 0)
 	default:
 		valueOf := reflect.ValueOf(anything)
+		if valueOf.IsNil() {
+			return ""
+		}
 		switch valueOf.Kind() {
 		case reflect.Bool:
 			return BoxString(name, fmt.Sprintf("%t", anything), 0)