aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--prog/size.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/prog/size.go b/prog/size.go
index 5586d0da5..23248c722 100644
--- a/prog/size.go
+++ b/prog/size.go
@@ -47,6 +47,10 @@ func (target *Target) assignSize(dst *ConstArg, pos Arg, path []string, args []A
continue
}
buf = InnerArg(buf)
+ if buf == nil {
+ dst.Val = 0 // target is an optional pointer
+ return
+ }
if len(path) == 0 {
dst.Val = target.computeSize(buf, dst.Type().(*LenType))
} else {