From 6131c4b261ecf7174140a9f540c17457ced3368f Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sat, 8 Mar 2025 10:12:33 +0000 Subject: [PATCH] Fix crash FossilOrigin-Name: b5a250176b51af0c83455b933ed31190ed1bb11a972bdf92fbb3f3e7ad96c06e --- src/commands.mm | 2 +- src/console.mm | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/commands.mm b/src/commands.mm index bdd1bbb..d4a1e27 100644 --- a/src/commands.mm +++ b/src/commands.mm @@ -236,7 +236,7 @@ execute( @try { val = (int)[c longLongValueWithBase:0]; } @catch (OFInvalidFormatException *e) { - conoutf(@"unknown command: %s", c); + conoutf(@"unknown command: %@", c); } } else { if ([identifier diff --git a/src/console.mm b/src/console.mm index 2a95cfa..bedb218 100644 --- a/src/console.mm +++ b/src/console.mm @@ -191,14 +191,15 @@ keypress(int code, bool isdown, int cooked) break; case SDLK_BACKSPACE: - case SDLK_LEFT: { - [commandbuf - deleteCharactersInRange: - OFMakeRange(commandbuf.length - 1, 1)]; + case SDLK_LEFT: + if (commandbuf.length > 0) + [commandbuf + deleteCharactersInRange: + OFMakeRange( + commandbuf.length - 1, 1)]; resetcomplete(); break; - } case SDLK_UP: if (histpos)