From 3f4653400f1ad0ac07d9a4ac905777772494f41d Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 28 Jul 2023 15:24:47 +0800 Subject: [PATCH] Avoid crashes when the primary clip is empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/androidselect.c (Fandroid_get_clipboard): Don't return data if clipboard is empty. Reported by Johan Widén . --- src/androidselect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/androidselect.c b/src/androidselect.c index f5371280457..9910e7921de 100644 --- a/src/androidselect.c +++ b/src/androidselect.c @@ -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, -- 2.39.5