mirror of
https://github.com/postgres/postgres.git
synced 2025-05-22 00:02:02 -04:00
Fix transformJsonBehavior
Commit 1a36bc9dba8 conained some logic that was a little opaque and could have involved a NULL dereference, as complained about by Coverity. Make the logic more transparent and in doing so avoid the NULL dereference.
This commit is contained in:
parent
cd4868a570
commit
fcdb35c32a
@ -4072,13 +4072,15 @@ static JsonBehavior *
|
||||
transformJsonBehavior(ParseState *pstate, JsonBehavior *behavior,
|
||||
JsonBehaviorType default_behavior)
|
||||
{
|
||||
JsonBehaviorType behavior_type;
|
||||
Node *default_expr;
|
||||
|
||||
behavior_type = behavior ? behavior->btype : default_behavior;
|
||||
default_expr = behavior_type != JSON_BEHAVIOR_DEFAULT ? NULL :
|
||||
transformExprRecurse(pstate, behavior->default_expr);
|
||||
JsonBehaviorType behavior_type = default_behavior;
|
||||
Node *default_expr = NULL;
|
||||
|
||||
if (behavior)
|
||||
{
|
||||
behavior_type = behavior->btype;
|
||||
if (behavior_type == JSON_BEHAVIOR_DEFAULT)
|
||||
default_expr = transformExprRecurse(pstate, behavior->default_expr);
|
||||
}
|
||||
return makeJsonBehavior(behavior_type, default_expr);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user