windows/windDisp.c: Redundant null check due to previous dereference
Fix code scanning alert no. 133: Redundant null check due to previous dereference (#40) * Update windDisp.c * DLM - AI wanted to guard the '*area' dereference in if() statement, but the code path above has address of '&' operator for the assignment to 'area' so it must always be non-null. So I rejected this approach and removed the extra null check, replacing it with an assert(). --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
499ac84ac0
commit
d1dc038cb7
|
|
@ -19,6 +19,7 @@
|
|||
static char rcsid[] __attribute__ ((unused)) = "$Header$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tcltk/tclmagic.h"
|
||||
|
|
@ -337,9 +338,11 @@ WindAreaChanged(w, area)
|
|||
/* will be copied into on the next display redraw. */
|
||||
|
||||
if ((w != NULL) && (w->w_backingStore == (ClientData)NULL) &&
|
||||
(!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL))
|
||||
if ((area == (Rect *)NULL) || GEO_SURROUND(&biggerArea, &w->w_screenArea))
|
||||
(!(w->w_flags & WIND_OBSCURED)) && (GrCreateBackingStorePtr != NULL)) {
|
||||
assert(area); // area is non-null
|
||||
if (GEO_SURROUND(&biggerArea, &w->w_screenArea))
|
||||
(*GrCreateBackingStorePtr)(w);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Reference in New Issue