summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-08-09 23:21:44 +0200
committerAraq <rumpf_a@web.de>2015-08-09 23:21:44 +0200
commitbbf9757b4e70c7a11701656bc7755d7d76669dad (patch)
tree8a00f4ec0cbd72b5f526e3d9098be224861a0690 /compiler
parent50861792f447d1a5213fcc9ebbfefae6ee146830 (diff)
downloadNim-bbf9757b4e70c7a11701656bc7755d7d76669dad.tar.gz
refs #2377
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rodread.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rodread.nim b/compiler/rodread.nim
index 92ce00240..e4530c2cc 100644
--- a/compiler/rodread.nim
+++ b/compiler/rodread.nim
@@ -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