Ensure that a dereferenced variable isn't NULL.

Found by clang static analyzer.
This commit is contained in:
John Ralls 2018-11-28 15:40:21 +09:00
parent 43a30e1c97
commit 4ffeb3efac
2 changed files with 3 additions and 3 deletions

View File

@ -1752,7 +1752,7 @@ xaccTransRollbackEdit (Transaction *trans)
if (!qof_instance_is_dirty(QOF_INSTANCE(s)))
continue;
if (i < num_preexist)
if (i < num_preexist && onode)
{
Split *so = onode->data;

View File

@ -486,7 +486,7 @@ compile_sort (QofQuerySort *sort, QofIdType obj)
/* If we have valid parameters, grab the compare function,
* If not, check if this is the default sort.
*/
if (sort->param_fcns)
if (sort->param_fcns && resObj)
{
/* First, check if this parameter has a sort function override.
* if not then check if there's a global compare function for the type
@ -535,7 +535,7 @@ static void compile_terms (QofQuery *q)
* If not, see if this is the default sort.
*/
if (qt->param_fcns)
if (qt->param_fcns && resObj)
qt->pred_fcn = qof_query_core_get_predicate (resObj->param_type);
else
qt->pred_fcn = NULL;