From af6adcc9730d18d94b263253a9b12ecbd9d6469c Mon Sep 17 00:00:00 2001 From: project-repo Date: Thu, 21 May 2020 17:17:11 +0200 Subject: [PATCH] Fix null pointer dereference warning --- view.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/view.c b/view.c index f90baaf..609b01e 100644 --- a/view.c +++ b/view.c @@ -223,17 +223,15 @@ view_for_each_popup(struct cg_view *view, wlr_surface_iterator_func_t iterator, view->impl->for_each_popup(view, iterator, data); } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wanalyzer-null-dereference" void view_unmap(struct cg_view *view) { #if CG_HAS_XWAYLAND if((view->type != CG_XWAYLAND_VIEW || xwayland_view_should_manage(view))) #endif { - if(view_is_visible(view)) { + struct cg_tile *view_tile = view_get_tile(view); + if(view_tile != NULL) { struct cg_view *prev = view_get_prev_view(view); - struct cg_tile *view_tile = view_get_tile(view); wlr_output_damage_add_box(view_tile->workspace->output->damage, &view_tile->tile); if((view->workspace->server->seat->seat->keyboard_state @@ -265,7 +263,6 @@ view_unmap(struct cg_view *view) { } } #endif -#pragma GCC diagnostic pop wl_list_remove(&view->link);