Skip to content

Commit

Permalink
Fix console related crash mentioned in issue #48
Browse files Browse the repository at this point in the history
  • Loading branch information
Ochii committed Feb 24, 2019
1 parent 5f9bf72 commit dbc7b00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions launcher/source/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void GameConsole::DrawCompleteList( void )
void GameConsole::ToggleConsole( bool extend )
{
if ( !m_bDrawExtend && m_bShowConsole )
ClearInput();
ClearInput();

if ( extend && m_bShowConsole && m_CompleteCandidates.size() > 6 )
{
Expand All @@ -339,7 +339,7 @@ void GameConsole::ToggleConsole( bool extend )
m_bShowConsole =
( extend && m_bShowConsole ) ? m_bShowConsole : !m_bShowConsole;

// Disable game input while the console is enabled
// Disable game input while the console is enabled
g_pInputSystem->EnableInput( !m_bShowConsole );
}

Expand Down Expand Up @@ -515,8 +515,11 @@ int GameConsole::ConsoleInputCallBack( ImGuiInputTextCallbackData* data )
// current input line along with cursor position.
if ( prev_history_pos != m_HistoryPos )
{
std::string_view history_str =
( m_HistoryPos >= 0 ) ? m_History[m_HistoryPos] : "";
std::string_view history_str = "";

if ( m_HistoryPos != INVALID_POSITION )
history_str = m_History[m_HistoryPos];

data->DeleteChars( 0, data->BufTextLen );
data->InsertChars( 0, history_str.data() );
}
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.4.1

0 comments on commit dbc7b00

Please sign in to comment.