mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Don't crash on reading empty index
This commit is contained in:
parent
bfe935b5ab
commit
8589a0fb40
@ -69,8 +69,10 @@ func (r *marshalReader) readHeader() header {
|
||||
}
|
||||
|
||||
func (r *marshalReader) readIndex() []FileInfo {
|
||||
var files []FileInfo
|
||||
nfiles := r.readUint32()
|
||||
files := make([]FileInfo, nfiles)
|
||||
if nfiles > 0 {
|
||||
files = make([]FileInfo, nfiles)
|
||||
for i := range files {
|
||||
files[i].Name = r.readString()
|
||||
files[i].Flags = r.readUint32()
|
||||
@ -83,6 +85,7 @@ func (r *marshalReader) readIndex() []FileInfo {
|
||||
}
|
||||
files[i].Blocks = blocks
|
||||
}
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user