[vlc-devel] [PATCH 2/2] android: window: check jobj before creating window

Alexandre Janniaux ajanni at videolabs.io
Fri Jan 22 14:02:15 UTC 2021


To avoid creating a AWindowHandler without window.
---
 modules/video_output/android/window.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/video_output/android/window.c b/modules/video_output/android/window.c
index 0b8d0337ed..0f601e4af2 100644
--- a/modules/video_output/android/window.c
+++ b/modules/video_output/android/window.c
@@ -90,6 +90,11 @@ static const struct vout_window_operations ops = {
  */
 static int Open(vout_window_t *wnd)
 {
+    /* We cannot create a window without the associated AWindow instance. */
+    jobject jobj = var_InheritAddress(wnd, "drawable-androidwindow");
+    if (jobj == NULL)
+        return VLC_EGENERIC;
+
     AWindowHandler *p_awh = AWindowHandler_new(VLC_OBJECT(wnd), wnd,
         &(awh_events_t) { OnNewWindowSize, OnNewMouseCoords });
     if (p_awh == NULL)
-- 
2.30.0



More information about the vlc-devel mailing list