mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Refs #34975 -- Handled optional source expressions in Expression.get_refs().
While no code is directly exercising get_refs in a way that triggers a crash some expressions such as Window stash None in source_expressions which can obscure the origin of some bugs. Handling None values like we do in other source_expression traversing methods such as .contains_aggregates ensures we don't run into surprises in the future where get_refs() might be used for a different purpose.
This commit is contained in:
parent
d7a9f006ed
commit
911b1619ab
@ -417,6 +417,8 @@ class BaseExpression:
|
||||
def get_refs(self):
|
||||
refs = set()
|
||||
for expr in self.get_source_expressions():
|
||||
if expr is None:
|
||||
continue
|
||||
refs |= expr.get_refs()
|
||||
return refs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user