Avoid false positives in Clang static analyzer

This assert should avoid three null-pointer dereference warnings, that
get flagged later in the same function, assuming that worker is null.

Change-Id: I1bf521fa335ee14b8ac98e872f31ef704f386efe
CodeChecker-report-hash: 38b39301a55fdb09bb0ec7cd43aa4f5e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Dimitrios Apostolou 2020-11-10 15:45:09 +01:00
parent 062ba97f86
commit 4e935e35f1

View File

@ -187,6 +187,7 @@ typedef ptrdiff_t QT_FT_PtrDist;
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#define QT_FT_UNUSED( x ) (void) x
@ -1837,8 +1838,11 @@ QT_FT_END_STMNT
if ( !raster || !raster->buffer || !raster->buffer_size )
return ErrRaster_Invalid_Argument;
if ( raster->worker )
raster->worker->skip_spans = params->skip_spans;
/* Should always be non-null, it is set by raster_reset() which is always */
/* called with a non-null pool, and a pool_size >= MINIMUM_POOL_SIZE. */
assert(raster->worker);
raster->worker->skip_spans = params->skip_spans;
/* If raster object and raster buffer are allocated, but */
/* raster size isn't of the minimum size, indicate out of */