From 0e8e487fdd3698ddadb4f259a4180e39a87eea4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KevinZ=C3=B8nda?= <33132228+KevinZonda@users.noreply.github.com> Date: Mon, 8 May 2023 16:11:35 +0100 Subject: [PATCH] fix: possible NRE --- variable/parser.go | 3 ++- variable/types/float.go | 1 - variable/types/int.go | 1 - variable/types/string.go | 5 +---- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/variable/parser.go b/variable/parser.go index d1f17cd..dc7ea4a 100644 --- a/variable/parser.go +++ b/variable/parser.go @@ -58,7 +58,8 @@ func typeFactory(varType string, name string) interfaces.Variable { case "float": return types.NewFloat(name) default: - return nil + // FIXME: cannot parse this type! + return types.NewString(name) } } diff --git a/variable/types/float.go b/variable/types/float.go index ad377de..1cd4efa 100644 --- a/variable/types/float.go +++ b/variable/types/float.go @@ -8,7 +8,6 @@ import ( type FloatType struct { BaseType - value float64 } func (i *FloatType) SetValue(s string) bool { diff --git a/variable/types/int.go b/variable/types/int.go index 669bd79..70e6114 100644 --- a/variable/types/int.go +++ b/variable/types/int.go @@ -7,7 +7,6 @@ import ( type IntType struct { BaseType - value int64 } func (i *IntType) SetValue(s string) bool { diff --git a/variable/types/string.go b/variable/types/string.go index 7a03312..05a7051 100644 --- a/variable/types/string.go +++ b/variable/types/string.go @@ -6,10 +6,7 @@ import ( type StringType struct { BaseType - name string - constraint interfaces.Constraint - value string - hasVal bool + name string } func (s *StringType) SetValue(s2 string) bool {