]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid crashes when the primary clip is empty
authorPo Lu <luangruo@yahoo.com>
Fri, 28 Jul 2023 07:24:47 +0000 (15:24 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 28 Jul 2023 07:24:47 +0000 (15:24 +0800)
* src/androidselect.c (Fandroid_get_clipboard): Don't return
data if clipboard is empty.  Reported by Johan Widén
<j.e.widen@gmail.com>.

src/androidselect.c

index f537128045776ec7dc008f31ad79b237c3e4cf4d..9910e7921de0bed1110c734e6fe8d6af3aeec29a 100644 (file)
@@ -194,6 +194,9 @@ Alternatively, return nil if the clipboard is empty.  */)
                                             method);
   android_exception_check ();
 
+  if (!bytes)
+    return Qnil;
+
   length = (*android_java_env)->GetArrayLength (android_java_env,
                                                bytes);
   data = (*android_java_env)->GetByteArrayElements (android_java_env,