-
-
Notifications
You must be signed in to change notification settings - Fork 579
Closed
Labels
Description
I am not sure if this is a bug. I got panic when running a test:
here is the complete result:
panic: interface conversion: types.Object is types.StreamDict, not types.Dict
goroutine 8 [running]:
testing.tRunner.func1.2({0xb381a0, 0xc0007b0000})
/opt/hostedtoolcache/go/1.[20](https://github.com/aysf/gopdf/actions/runs/5994786628/job/16256862912#step:5:21).7/x64/src/testing/testing.go:1526 +0x372
testing.tRunner.func1()
/opt/hostedtoolcache/go/1.20.7/x64/src/testing/testing.go:1529 +0x650
panic({0xb381a0, 0xc0007b0000})
/opt/hostedtoolcache/go/1.20.7/x64/src/runtime/panic.go:890 +0x263
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.migrateAnnots({0xca5120, 0xc000bec790}, {0x3, 0x0}, 0xc000da6540, 0x9cd1f1?, 0x0?)
/home/runner/go/pkg/mod/github.com/pdfcpu/[email protected]/pkg/pdfcpu/migrate.go:110 +0x8a5
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.migratePageDict(0xba4800?, {0xca5090?, 0xc000c7fda0?}, 0x8?, 0xb4[22](https://github.com/aysf/gopdf/actions/runs/5994786628/job/16256862912#step:5:23)a0?, 0x4a93a5?)
/home/runner/go/pkg/mod/github.com/pdfcpu/[email protected]/pkg/pdfcpu/migrate.go:144 +0x199
from the log, the panic is came from this line:
Line 110 in d94b537
| d := o1.(types.Dict) |
is it possible to add a type checker or handler if the type is not appropriate?
for example
d, ok := o1.(types.Dict)
if !ok {
return nil, errors.New("pdfcpu: types.Object is types.StreamDict, not types.Dict")
}
note:
this is the repo (https://github.com/aysf/gopdf) that I use for testing