Commit b5b3b0a
committed
BUG: Add null checks after ReadHeader in IPLCommonImageIO
The base class ReadHeader returns nullptr, and subclass overrides may
also return null without throwing. Two call sites in ReadImageInformation
dereference the result without null checks:
1. m_ImageHeader->modality (line 140) — null dereference when ReadHeader
fails silently. Now throws itkExceptionMacro on null return.
2. curImageHeader->examNumber (line 223) — null dereference in the
directory scan loop. Now skips null results with continue.
Addresses nullability.NullPassedToNonnull and core.NullDereference
findings from issue #1261.1 parent 22f6d27 commit b5b3b0a
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
| |||
0 commit comments