From 694fdc1174c82595ac161850f572eade6b126838 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Mon, 8 Mar 2021 13:31:44 -0700 Subject: check if "LANG" environment variable exists before indexing it --- spellcheck.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit