From d3b3a6a1d683f1695cfbad3ba255dfc57dd2a7c4 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 28 Sep 2013 13:22:37 +0000 Subject: Added null pointer check to format.get_ini_entry to avoid exception --- format.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'format.lua') diff --git a/format.lua b/format.lua index fc46e36..e97e6f4 100644 --- a/format.lua +++ b/format.lua @@ -496,10 +496,17 @@ function get_ini_entry (file, section, value) opts = parse_ini_file(file) end section = section or "" - local result = opts[section][value] + local result + if opts and opts[section] then + result = opts[section][value] + end if not result then section = "" - result = opts[section][value] or "" + if opts and opts[section] then + result = opts[section][value] or "" + else + result = "" + end end while string.find(result, "%$[%w_]+") do local sub = string.match(result, "%$[%w_]+") -- cgit v1.2.3