Merge pull request #203 from kortschak/defensive

Make graph.Delta zero state invalid for use
This commit is contained in:
Barak Michener 2015-02-03 18:53:17 -05:00
commit 327b6aac49
5 changed files with 20 additions and 5 deletions

View file

@ -185,6 +185,9 @@ func (qs *QuadStore) ApplyDeltas(deltas []graph.Delta) error {
resizeMap := make(map[string]int64)
sizeChange := int64(0)
for _, d := range deltas {
if d.Action != graph.Add && d.Action != graph.Delete {
return errors.New("leveldb: invalid action")
}
bytes, err := json.Marshal(d)
if err != nil {
return err