Skip to content

Commit

Permalink
fix bad dir structure err
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlehane committed Apr 22, 2015
1 parent 109c580 commit 2255226
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,21 @@ func fixName(f *File) {
func (r *Reader) traverse() error {
r.indexes = make([]int, len(r.File))
var idx int
var recurse func(i int, path []string)
var recurse func(int, []string)
var err error
recurse = func(i int, path []string) {
if i < 0 || i >= len(r.File) || idx >= len(r.indexes) {
if i < 0 || i >= len(r.File) {
err = ErrBadDir
return
}
file := r.File[i]
if file.leftSibID != noStream {
recurse(int(file.leftSibID), path)
}
if idx >= len(r.indexes) {
err = ErrBadDir
return
}
r.indexes[idx] = i
file.Path = path
idx++
Expand Down

0 comments on commit 2255226

Please sign in to comment.