coverity/188735: last_nonfloat: Ensure wp is non-NULL before dereferencing

This commit is contained in:
James McCoy 2021-05-05 23:08:46 -04:00
parent 833a6fcb60
commit f6d4226f4d
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -2199,7 +2199,7 @@ bool one_nonfloat(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
/// always false for a floating window
bool last_nonfloat(win_T *wp) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return firstwin == wp && !(wp->w_next && !wp->w_floating);
return wp != NULL && firstwin == wp && !(wp->w_next && !wp->w_floating);
}
/// Close the possibly last window in a tab page.