Commit 26b987c7 authored by Erlend Hamberg's avatar Erlend Hamberg
Browse files

fix crash when navigating in an empty document

BUG: 274280
parent 486b8936
......@@ -269,12 +269,15 @@ bool KateViNormalMode::handleKeypress( const QKeyEvent *e )
if ( r.endLine >= doc()->lines() ) r.endLine = doc()->lines()-1;
// make sure the position is valid before moving the cursor there
// TODO: can this be simplified? :/
if ( r.valid
&& r.endLine >= 0
&& ( r.endLine == 0 || r.endLine <= doc()->lines()-1 )
&& r.endColumn >= 0 ){
if ( r.endColumn >= doc()->lineLength( r.endLine ))
&& r.endColumn >= 0 ) {
if ( r.endColumn >= doc()->lineLength( r.endLine )
&& doc()->lineLength( r.endLine ) > 0 ) {
r.endColumn = doc()->lineLength( r.endLine ) - 1;
}
kDebug( 13070 ) << "No command given, going to position ("
<< r.endLine << "," << r.endColumn << ")";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment