summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-10-12 14:00:58 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-10-12 14:00:58 -0700
commitf4ad8b8f8d0af1db6c45d5927e136b06682c81f7 (patch)
tree448e1195816a6a2b41b92599ce3af3fc56d0a6ea /crawl-ref/source/initfile.cc
parentfa9a5721b1e903f5e2435d928183621071d45cc4 (diff)
downloadcrawl-ref-f4ad8b8f8d0af1db6c45d5927e136b06682c81f7.tar.gz
crawl-ref-f4ad8b8f8d0af1db6c45d5927e136b06682c81f7.zip
8 color terminal: check whether getenv() returns null before string compare
Oops. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index a5b1a86a72..561cbeb645 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -961,10 +961,11 @@ void game_options::reset_options()
#endif
// map each colour to itself as default
- // If USE_8_COLOUR_TERM_MAP is defined, then we force 8 colors.
- // Otherwise, do a check to see if we're using Apple_Terminal.
+ // If USE_8_COLOUR_TERM_MAP is defined, then we force 8 colors.
+ // Otherwise, do a check to see if we're using Apple_Terminal.
#ifndef USE_8_COLOUR_TERM_MAP
- if (strcmp(getenv("TERM_PROGRAM"), "Apple_Terminal") == 0) {
+ const char *term_program = getenv("TERM_PROGRAM");
+ if (term_program && strcmp(term_program, "Apple_Terminal") == 0) {
#endif
for (int i = 0; i < 16; i++)
colour[i] = i % 8;