diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-14 20:58:33 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-14 20:58:33 +0200 |
| commit | bd4e3ac77b56f644b6e5afc8c43c8a77848dbb52 (patch) | |
| tree | 6f56d4b20f0c36bfb6c9cd4386d9365a35cc85ee /prog/size.go | |
| parent | 2e6300854a5f61abb99404d2fbbc9b9a419694a3 (diff) | |
prog: fix crash in assignSize on optional pointer
Diffstat (limited to 'prog/size.go')
| -rw-r--r-- | prog/size.go | 4 |
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 { |
