From a22cd2c68c71481c653d9f6547f2e7b46ce57106 Mon Sep 17 00:00:00 2001 From: Hugh Wang Date: Thu, 8 Jun 2017 00:26:02 +0800 Subject: [PATCH] Fix crash when colors are disabled --- src/curses/window.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/curses/window.cpp b/src/curses/window.cpp index 5a83b59c..0222888d 100644 --- a/src/curses/window.cpp +++ b/src/curses/window.cpp @@ -214,6 +214,10 @@ Color Color::End(0, 0, false, true); int Color::pairNumber() const { + // If colors are disabled, return default pair value. + if (color_pair_map.empty()) + return 0; + int result = 0; if (isEnd()) throw std::logic_error("'end' doesn't have a corresponding pair number");