diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-10-30 09:15:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-10-30 14:47:26 +0100 |
commit | f69980d036b3f388982d7b1b2907cc165ee04b52 (patch) | |
tree | a0d44da9a6f643829cd27bf5f975f55680fed450 /libreofficekit | |
parent | cf627ab2c8c070a620c81cff1faf7b6f04205255 (diff) |
Don't call std::string::erase with end()
Change-Id: I64afcbe7138de7c7655a8107fd25e3ac8393a55d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175824
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx index 0f80a365ab0f..c998eeeccb2b 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx @@ -219,7 +219,9 @@ void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ ) static void addToRecentUnoCommands(GtvApplicationWindow* pWindow, const std::string& rUnoCmd, std::string aArgs) { GtvMainToolbar* pToolbar = gtv_application_window_get_main_toolbar(pWindow); - aArgs.erase(std::find(aArgs.begin(), aArgs.end(), '\n')); + auto it = std::find(aArgs.begin(), aArgs.end(), '\n'); + if (it != aArgs.end()) + aArgs.erase(it); const std::string rUnoCmdStr = rUnoCmd + " | " + aArgs; |