Commit 3b49748
fix(utils): guard against None entries in sum_fields_if_not_none (#773)
When ApiMeta.billed_units is None (its default), merge_meta_field builds
a list containing None. The list comprehension in sum_fields_if_not_none
called getattr(obj, field) without checking if obj is None first, raising
AttributeError. Adding `obj is not None` before the getattr check fixes it.
Co-authored-by: Ishaan Samantray <ishaansamantray@mac.mynetworksettings.com>1 parent 6a49b0b commit 3b49748
2 files changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
| |||
0 commit comments