[PATCH weston 05/12] fullscreen-shell: Avoid NULL pointer dereference

Armin Krezović krezovic.armin at gmail.com
Thu Jun 23 09:59:33 UTC 2016


When there are no outputs present, an output pointer
can be NULL. Dereferencing such pointer will result
in a crash.

Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
---
 fullscreen-shell/fullscreen-shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index a32e46a..ecaebfa 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -288,7 +288,7 @@ fs_output_for_output(struct weston_output *output)
 static void
 restore_output_mode(struct weston_output *output)
 {
-	if (output->original_mode)
+	if (output && output->original_mode)
 		weston_output_mode_switch_to_native(output);
 }
 
-- 
2.9.0



More information about the wayland-devel mailing list