bugfix: make sure that even unnamed parts at the end can be read
* seek does not fail, even if the pointer is beyond the end of the file
This commit is contained in:
parent
ade1c6e06e
commit
d2cf77fb99
|
@ -406,7 +406,12 @@ func getValues(descr fileDescription, binpath string) map[string]string {
|
|||
optPanic("failed to open binary", err)
|
||||
for i, part := range descr.parts {
|
||||
if part.name == "" {
|
||||
_, err = f.Seek(part.handling.bytes, 1)
|
||||
if i == len(descr.parts)-1 {
|
||||
throwaway := make([]byte, part.handling.bytes)
|
||||
_, err = f.Read(throwaway)
|
||||
} else {
|
||||
_, err = f.Seek(part.handling.bytes, 1)
|
||||
}
|
||||
optPanic(seekErr(i, part.name, err), err)
|
||||
} else {
|
||||
vals[part.name] = part.handling.readFrom(f, descr.byteOrder)
|
||||
|
|
Loading…
Reference in New Issue
Block a user