aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-09-29 00:11:05 +0200
committerAyke van Laethem <[email protected]>2018-09-29 00:11:05 +0200
commit318567f3989a4b90d85a87b1fd67656a2413389d (patch)
treed4a132fda9ddc42e3023f4586a1c014298ee9524 /ir
parent8d170d3bd291f110a9bc72cd462d6c86557897e0 (diff)
downloadtinygo-318567f3989a4b90d85a87b1fd67656a2413389d.tar.gz
tinygo-318567f3989a4b90d85a87b1fd67656a2413389d.zip
ir: fix nil pointer dereference in IsVolatile
Diffstat (limited to 'ir')
-rw-r--r--ir/ir.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/ir/ir.go b/ir/ir.go
index 684d94a4a..fd1cbe85a 100644
--- a/ir/ir.go
+++ b/ir/ir.go
@@ -425,6 +425,9 @@ func (p *Program) IsVolatile(t types.Type) bool {
if t, ok := t.(*types.Named); !ok {
return false
} else {
+ if t.Obj().Pkg() == nil {
+ return false
+ }
id := t.Obj().Pkg().Path() + "." + t.Obj().Name()
doc := p.comments[id]
if doc == nil {