Skip to content

Commit f85ab9a

Browse files
committed
Catch exception when pasting with invalid data in the clipboard
1 parent 106b31e commit f85ab9a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ internal static string GetTextToPaste(DataObjectPastingEventArgs pastingEventArg
482482
} catch (OutOfMemoryException) {
483483
// may happen when trying to paste a huge string
484484
return null;
485+
} catch (COMException) {
486+
// may happen with incorrect data => Data on clipboard is invalid (Exception from HRESULT: 0x800401D3 (CLIPBRD_E_BAD_DATA))
487+
return null;
485488
}
486489
}
487490
#endregion

0 commit comments

Comments
 (0)