diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-07-18 22:59:26 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-07-18 22:59:31 +0200 |
commit | f6e28b81a8dd982af06942cc0aaa3ff6da8d67f7 (patch) | |
tree | 65a26c869c8587edbf684556a0611cede802d5b5 | |
parent | Merge pull request #343 (diff) | |
parent | console_handler: do not call a NULL function pointer (diff) | |
download | monero-f6e28b81a8dd982af06942cc0aaa3ff6da8d67f7.tar.xz |
Merge pull request #344
e027831 console_handler: do not call a NULL function pointer (moneromooo-monero)
b87e066 console_handler: check for eof before trying to use input (moneromooo-monero)
-rw-r--r-- | contrib/epee/include/console_handler.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 952fc3c96..5dd3eaba9 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -274,14 +274,15 @@ namespace epee } std::string command; - if(!m_stdin_reader.get_line(command)) - { - LOG_PRINT("Failed to read line.", LOG_LEVEL_0); - } + bool get_line_ret = m_stdin_reader.get_line(command); if (m_stdin_reader.eos()) { break; } + if (!get_line_ret) + { + LOG_PRINT("Failed to read line.", LOG_LEVEL_0); + } string_tools::trim(command); LOG_PRINT_L2("Read command: " << command); @@ -303,7 +304,8 @@ namespace epee std::cout << usage; } } - exit_handler(); + if (exit_handler) + exit_handler(); return true; CATCH_ENTRY_L0("console_handler", false); } |