Commit c80d382
committed
feat: Return error when popping last limit in reader
- Updated `PopLimit` in `pkg/dicomio/reader.go` to return an error when attempting to pop from an empty stack, preventing a panic.
- Added `ErrorLimitStackEmpty` to exported errors.
- Moved stack check to the beginning of `PopLimit` to avoid skipping bytes if the operation is invalid.
- Updated call sites in `read.go` to handle or ignore the returned error appropriately.1 parent 6357e3e commit c80d382
2 files changed
Lines changed: 27 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
184 | | - | |
185 | | - | |
186 | 193 | | |
187 | 194 | | |
| 195 | + | |
188 | 196 | | |
189 | 197 | | |
190 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
| |||
624 | 627 | | |
625 | 628 | | |
626 | 629 | | |
627 | | - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
628 | 633 | | |
629 | 634 | | |
630 | 635 | | |
| |||
667 | 672 | | |
668 | 673 | | |
669 | 674 | | |
670 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
671 | 678 | | |
672 | 679 | | |
673 | 680 | | |
| |||
766 | 773 | | |
767 | 774 | | |
768 | 775 | | |
769 | | - | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
770 | 779 | | |
771 | 780 | | |
772 | 781 | | |
| |||
822 | 831 | | |
823 | 832 | | |
824 | 833 | | |
825 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
826 | 837 | | |
827 | 838 | | |
828 | 839 | | |
| |||
0 commit comments