From 310b46c992856ae315de40feae88b2dbbd163942 Mon Sep 17 00:00:00 2001 From: "H. S. Teoh" Date: Fri, 8 Aug 2014 14:43:17 -0700 Subject: [PATCH] Gah, need to use .get to handle case when environment variable isn't defined. Otherwise it would throw a runtime exception. :-( --- terminal.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terminal.d b/terminal.d index 7cf641d..0a625d6 100644 --- a/terminal.d +++ b/terminal.d @@ -303,7 +303,7 @@ struct Terminal { bool terminalInFamily(string[] terms...) { import std.process; import std.string; - auto term = environment["TERM"]; + auto term = environment.get("TERM"); foreach(t; terms) if(indexOf(term, t) != -1) return true; @@ -393,9 +393,9 @@ struct Terminal { import std.string; import std.array; - string termcapData = environment["TERMCAP"]; + string termcapData = environment.get("TERMCAP"); if(termcapData.length == 0) { - termcapData = getTermcapDatabase(environment["TERM"]); + termcapData = getTermcapDatabase(environment.get("TERM")); } auto e = replace(termcapData, "\\\n", "\n");