diff options
author | pecksin <pexin@protonmail.com> | 2021-03-22 18:45:17 -0400 |
---|---|---|
committer | pecksin <pexin@protonmail.com> | 2021-03-22 18:45:17 -0400 |
commit | f5e1b6eedcf0315fe1dd10e6deaf41f89b5cc589 (patch) | |
tree | ee975ec54ee43976dff768e067d8d6a602402cf4 /src | |
parent | 7054232044c1b0ccf50e80d40e5d3d8a37062415 (diff) | |
download | minetest-f5e1b6eedcf0315fe1dd10e6deaf41f89b5cc589.tar.gz minetest-f5e1b6eedcf0315fe1dd10e6deaf41f89b5cc589.tar.bz2 minetest-f5e1b6eedcf0315fe1dd10e6deaf41f89b5cc589.zip |
fixed segfault with libncurses
Diffstat (limited to 'src')
-rw-r--r-- | src/chat.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/chat.cpp b/src/chat.cpp index 5a8afa908..b0223f8db 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -38,20 +38,24 @@ ChatBuffer::ChatBuffer(u32 scrollback): m_scrollback = 1; m_empty_formatted_line.first = true; - m_cache_clickable_chat_weblinks = g_settings->getBool("clickable_chat_weblinks"); - if(m_cache_clickable_chat_weblinks) + // Curses mode cannot access g_settings here + if(g_settings != NULL) { - std::string hexcode = g_settings->get("chat_weblink_color"); - u32 colorval = strtol(hexcode.c_str(), NULL, 16); - u32 redval,greenval,blueval; - blueval = colorval % 256; - colorval /= 256; - greenval = colorval % 256; - colorval /= 256; - redval = colorval % 256; - // discard alpha, if included - //m_cache_chat_weblink_color = irr::video::SColor(255,150,150,255); - m_cache_chat_weblink_color = irr::video::SColor(255,redval,greenval,blueval); + m_cache_clickable_chat_weblinks = g_settings->getBool("clickable_chat_weblinks"); + if(m_cache_clickable_chat_weblinks) + { + std::string hexcode = g_settings->get("chat_weblink_color"); + u32 colorval = strtol(hexcode.c_str(), NULL, 16); + u32 redval,greenval,blueval; + blueval = colorval % 256; + colorval /= 256; + greenval = colorval % 256; + colorval /= 256; + redval = colorval % 256; + // discard alpha, if included + //m_cache_chat_weblink_color = irr::video::SColor(255,150,150,255); + m_cache_chat_weblink_color = irr::video::SColor(255,redval,greenval,blueval); + } } } |