Skip to content

Commit

Permalink
Filestore: Prevent server crash when DataPtr.PosInfo is not set.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
  • Loading branch information
kevina committed Jun 3, 2016
1 parent 2fe38b3 commit fd077d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion filestore/support/misc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package filestore_support

import (
"errors"
//ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/ipfs/go-datastore"
"github.com/ipfs/go-ipfs/blocks"
"github.com/ipfs/go-ipfs/commands/files"
Expand All @@ -25,7 +26,9 @@ func (NodeToBlock) CreateBlock(nd *merkledag.Node) (blocks.Block, error) {
if nd.DataPtr == nil {
return b0, nil
}

if nd.DataPtr.PosInfo == nil || nd.DataPtr.PosInfo.Stat == nil {
return nil, errors.New("no file information for block")
}
b := &FilestoreBlock{
BasicBlock: *b0,
PosInfo: nd.DataPtr.PosInfo,
Expand Down

0 comments on commit fd077d3

Please sign in to comment.