ifd_builder.go: Fix `(*IfdBuilder).printTagTree()` printing of child IFDs

pull/28/head
Dustin Oprea 2019-12-29 20:56:35 -05:00
parent a4b93837a7
commit e5cdeb0aa4
1 changed files with 11 additions and 1 deletions

View File

@ -68,6 +68,8 @@ func (ibtv IfdBuilderTagValue) IsBytes() bool {
func (ibtv IfdBuilderTagValue) Bytes() []byte {
if ibtv.IsBytes() == false {
log.Panicf("this tag is not a byte-slice value")
} else if ibtv.IsIb() == true {
log.Panicf("this tag is an IFD-builder value not a byte-slice")
}
return ibtv.valueBytes
@ -80,6 +82,8 @@ func (ibtv IfdBuilderTagValue) IsIb() bool {
func (ibtv IfdBuilderTagValue) Ib() *IfdBuilder {
if ibtv.IsIb() == false {
log.Panicf("this tag is not an IFD-builder value")
} else if ibtv.IsBytes() == true {
log.Panicf("this tag is a byte-slice, not a IFD-builder")
}
return ibtv.ib
@ -602,7 +606,13 @@ func (ib *IfdBuilder) printTagTree(levels int) {
}
}
fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, tag)
value := tag.Value()
if value.IsIb() == true {
fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, value.Ib())
} else {
fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, tag)
}
if isChildIb == true {
if tag.value.IsIb() == false {