From 43495d70c71b34896086649b318ea654609d5179 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 26 Jul 2020 12:22:59 +0200 Subject: [PATCH] [#348] replication: return errors if .Send rpc returns a nil SendRes discovered while developing the next commit in this series --- replication/logic/replication_logic.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/replication/logic/replication_logic.go b/replication/logic/replication_logic.go index bb4bbde..6fd3379 100644 --- a/replication/logic/replication_logic.go +++ b/replication/logic/replication_logic.go @@ -550,7 +550,12 @@ func (s *Step) updateSizeEstimate(ctx context.Context) error { log.WithError(err).Error("dry run send request failed") return err } - s.expectedSize = sres.ExpectedSize + if sres == nil { + err := fmt.Errorf("dry run send request returned nil send result") + log.Error(err.Error()) + return err + } + s.expectedSize = sres.GetExpectedSize() return nil } @@ -581,6 +586,11 @@ func (s *Step) doReplication(ctx context.Context) error { log.WithError(err).Error("send request failed") return err } + if sres == nil { + err := fmt.Errorf("send request returned nil send result") + log.Error(err.Error()) + return err + } if stream == nil { err := errors.New("send request did not return a stream, broken endpoint implementation") return err