Commit 3a0c4a3
committed
fix: add defensive guards in Camera1Provider zoom methods
- getMaxZoomRatio: guard against null/empty getZoomRatios() list
and use Math.min to avoid ArrayIndexOutOfBoundsException on
vendor devices where list size < getMaxZoom() + 1
- setZoomRatio: reject NaN/Infinity/non-positive ratio early;
guard against null/empty zoomRatios list; use long arithmetic
to avoid int overflow in diff computation
Addresses coderabbitai review comments (Critical + Major).1 parent 1f328f1 commit 3a0c4a3
File tree
1 file changed
+11
-3
lines changed- library/src/main/java/org/wysaid/camera
1 file changed
+11
-3
lines changedLines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
170 | 177 | | |
| 178 | + | |
171 | 179 | | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
175 | | - | |
| 183 | + | |
176 | 184 | | |
177 | | - | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| |||
0 commit comments