Skip to content

Commit 37d7c38

Browse files
committed
WIP - avoid crash if chunk is nil
1 parent 012ae7a commit 37d7c38

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/plugin6/grpc_provider.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,10 @@ func (p *GRPCProvider) ReadStateBytes(r providers.ReadStateBytesRequest) (resp p
15561556
chunk, err := client.Recv()
15571557
if err == io.EOF {
15581558
// End of stream, we're done
1559-
resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(chunk.Diagnostics))
1559+
if chunk != nil {
1560+
// TODO: The EOF error could be just returned alongside the last chunk?
1561+
resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(chunk.Diagnostics))
1562+
}
15601563
break
15611564
}
15621565
if err != nil {

0 commit comments

Comments
 (0)