summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-07-10 22:04:04 +0200
committerEike Rathke <erack@redhat.com>2015-07-10 22:10:05 +0200
commit6a6b91da20e936abcc9f527f69aff48d2c23a94e (patch)
tree9c910c6e2a5a645ff0f818dc9bbdfd20c85923f9 /vcl/unx
parent871cd42b9588b2cb7bc26868f26bd38066acc102 (diff)
fix assert when pasting nil clipboard content
This happened when one of our modules had clipboard content and was closed, which currently clears the clipboard, and then reopened and attempting to paste the content. Apparently the utf-16 mime-type is still alive but the content isn't, on which rtl_str_getLength(pText) asserts. Change-Id: I5cc7c20ac1f1a8551a10b033e1f37bf83c5cc202
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/app/gtk3gtkinst.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx
index 2dedd2de8bb7..41708923cc2d 100644
--- a/vcl/unx/gtk3/app/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx
@@ -112,9 +112,10 @@ public:
GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
if (rFlavor.MimeType == "text/plain;charset=utf-16")
{
+ OUString aStr;
gchar *pText = gtk_clipboard_wait_for_text(clipboard);
- OUString aStr(pText, rtl_str_getLength(pText),
- RTL_TEXTENCODING_UTF8);
+ if (pText)
+ aStr = OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8);
g_free(pText);
css::uno::Any aRet;
aRet <<= aStr.replaceAll("\r\n", "\n");