From 794fd0e14ec7522549a95bae2edd16d7e384b3d8 Mon Sep 17 00:00:00 2001 From: wesley Date: Wed, 30 Sep 2020 06:42:16 +1000 Subject: [PATCH] Fix error iterating nil object when mapping functions to line numbers (#320) --- ldoc.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ldoc.lua b/ldoc.lua index 4cb9966..2ff2f5a 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -573,11 +573,13 @@ if ldoc.prettify_files then for F in file_list:iter() do files:append(F.filename) local mod = F.modules[1] - local ls = List() - for item in mod.items:iter() do - ls:append(item.lineno) + if mod then + local ls = List() + for item in mod.items:iter() do + ls:append(item.lineno) + end + linemap[F.filename] = ls end - linemap[F.filename] = ls end if type(ldoc.prettify_files) == 'table' then