Skip to content

Commit 3e5c7d3

Browse files
committed
check clipboard payload for null
We should check that the payload is not null before setting the clipboard, since otherwise we nuke the clipboard contents.
1 parent 7d586d1 commit 3e5c7d3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/TableView.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,20 @@ internal void CopyToClipboardInternal(bool includeHeaders)
418418
{
419419
return;
420420
}
421+
422+
var content = GetSelectedClipboardContent(includeHeaders);
421423

422-
var package = new DataPackage();
423-
package.SetText(GetSelectedClipboardContent(includeHeaders));
424+
if (string.IsNullOrWhiteSpace(content))
425+
{
426+
return;
427+
}
424428

425429
// Try/catch to prevent CLIPBRD_E_CANT_OPEN crashes.
426430
try
427431
{
432+
var package = new DataPackage();
433+
package.SetText(content);
434+
428435
Clipboard.SetContent(package);
429436
}
430437
catch (Exception ex)

0 commit comments

Comments
 (0)