From 68abb2d78b2720722a343b4bdcc45160af22307e Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 1 Jul 2024 21:08:37 +0800 Subject: [PATCH] fix: crash when clipboard is empty --- src/Views/CommitMessageTextBox.axaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Views/CommitMessageTextBox.axaml.cs b/src/Views/CommitMessageTextBox.axaml.cs index 70f978b8..1b458ede 100644 --- a/src/Views/CommitMessageTextBox.axaml.cs +++ b/src/Views/CommitMessageTextBox.axaml.cs @@ -128,10 +128,10 @@ namespace SourceGit.Views else if (e.Key == Key.V && ((OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Meta) || (!OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Control))) { var text = await App.GetClipboardTextAsync(); - text = text.Trim(); - - if (!string.IsNullOrEmpty(text)) + if (!string.IsNullOrWhiteSpace(text)) { + text = text.Trim(); + if (SubjectEditor.CaretIndex == Subject.Length) { var idx = text.IndexOf('\n');