summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-09-28 13:22:37 +0000
committerTed Trask <ttrask01@yahoo.com>2013-09-28 13:22:37 +0000
commitd3b3a6a1d683f1695cfbad3ba255dfc57dd2a7c4 (patch)
treee104aa392e55293954ca88e9a261c2b58a2060d0
parente1f4c7588e1eb6253c3c1b0ee82205426fde19ec (diff)
downloadacf-lib-d3b3a6a1d683f1695cfbad3ba255dfc57dd2a7c4.tar.bz2
acf-lib-d3b3a6a1d683f1695cfbad3ba255dfc57dd2a7c4.tar.xz
Added null pointer check to format.get_ini_entry to avoid exception
-rw-r--r--format.lua11
1 files changed, 9 insertions, 2 deletions
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_]+")