File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package androidbinary
22
33import (
44 "encoding/binary"
5- "errors"
65 "fmt"
76 "io"
87 "os"
@@ -239,11 +238,17 @@ func (p *TablePackage) findType(id int, config *ResTableConfig) *TableType {
239238
240239func (f * TableFile ) GetResource (id ResId , config * ResTableConfig ) (interface {}, error ) {
241240 p := f .findPackage (id .Package ())
241+ if p == nil {
242+ return nil , fmt .Errorf ("androidbinary: package 0x%02X not found" , id .Package ())
243+ }
242244 t := p .findType (id .Type (), config )
245+ if t == nil {
246+ return nil , fmt .Errorf ("androidbinary: type 0x%02X not found" , id .Type ())
247+ }
243248 e := t .Entries [id .Entry ()]
244249 v := e .Value
245250 if v == nil {
246- return nil , errors . New ( "get resource error" )
251+ return nil , fmt . Errorf ( "androidbinary: entry 0x%04X not found" , id . Entry () )
247252 }
248253 switch v .DataType {
249254 case TYPE_NULL :
You can’t perform that action at this time.
0 commit comments