This commit is contained in:
Araq
2015-08-09 23:21:44 +02:00
parent 50861792f4
commit bbf9757b4e

View File

@@ -898,6 +898,8 @@ proc getBody*(s: PSym): PNode =
## it may perform an expensive reload operation. Otherwise it's a simple
## accessor.
assert s.kind in routineKinds
# prevent crashes due to incorrect macro transformations (bug #2377)
if s.ast.isNil or bodyPos >= s.ast.len: return ast.emptyNode
result = s.ast.sons[bodyPos]
if result == nil:
assert s.offset != 0