File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,9 @@ var byteConv = values.NewFunction(
374
374
} else if v .Type ().Nature () == semantic .Dynamic {
375
375
v = v .Dynamic ().Inner ()
376
376
}
377
+ if v .IsNull () {
378
+ v = values .Null
379
+ }
377
380
378
381
switch v .Type ().Nature () {
379
382
case semantic .String :
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"github.com/influxdata/flux/dependencies/dependenciestest"
11
11
"github.com/influxdata/flux/dependency"
12
12
"github.com/influxdata/flux/memory"
13
+ "github.com/influxdata/flux/semantic"
13
14
"github.com/influxdata/flux/values"
14
15
)
15
16
@@ -786,3 +787,17 @@ func TestTypeconv_Duration(t *testing.T) {
786
787
})
787
788
}
788
789
}
790
+
791
+ func TestTypeconv_Bytes_NullString (t * testing.T ) {
792
+ myMap := map [string ]values.Value {
793
+ "v" : values .NewNull (semantic .BasicString ),
794
+ }
795
+ args := values .NewObjectWithValues (myMap )
796
+ c := byteConv
797
+ ctx , deps := dependency .Inject (context .Background (), dependenciestest .Default ())
798
+ defer deps .Finish ()
799
+ _ , err := c .Call (ctx , args )
800
+ if err == nil || err .Error () != "cannot convert null to bytes" {
801
+ t .Errorf (`Expected error "cannot convert null to bytes", got %q` , err )
802
+ }
803
+ }
You can’t perform that action at this time.
0 commit comments