aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Palamar <palamar@ualberta.ca>2021-03-08 13:31:44 -0700
committerRandy Palamar <palamar@ualberta.ca>2021-03-08 13:31:44 -0700
commit694fdc1174c82595ac161850f572eade6b126838 (patch)
treec1b76b03cccfcfb4f0cd7572d4993da3dde1cd5a
parent6f0b1f64058c394062a295ae5268b42a180bd529 (diff)
downloadvis-spellcheck-694fdc1174c82595ac161850f572eade6b126838.tar.gz
check if "LANG" environment variable exists before indexing it
-rw-r--r--spellcheck.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index d6bbcb3..d64505c 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -2,7 +2,11 @@
-- Use of this source code is governed by a MIT license found in the LICENSE file.
local spellcheck = {}
-spellcheck.lang = os.getenv("LANG"):sub(0,5) or "en_US"
+if os.getenv("LANG") then
+ spellcheck.lang = os.getenv("LANG"):sub(0,5)
+else
+ spellcheck.lang = "en_US"
+end
local supress_stdout = " >/dev/null"
local supress_stderr = " 2>/dev/null"
local supress_output = supress_stdout .. supress_stderr