From be840bf57db12126ed10f232c23a7f23ae87a042 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 12 May 2022 17:10:37 +0200 Subject: [PATCH] Fixed nil pointer exception --- commands/instances.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/instances.go b/commands/instances.go index 0f9722133cb..2ecf8827915 100644 --- a/commands/instances.go +++ b/commands/instances.go @@ -176,7 +176,11 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro if responseCallback == nil { responseCallback = func(r *rpc.InitResponse) {} } - instance := instances[req.Instance.Id] + reqInst := req.GetInstance() + if reqInst == nil { + return &arduino.InvalidInstanceError{} + } + instance := instances[reqInst.GetId()] if instance == nil { return &arduino.InvalidInstanceError{} }