From beda46b3e9c92932bb4fd96f9cdbc59527a7a50c Mon Sep 17 00:00:00 2001 From: CMGS Date: Wed, 25 Nov 2020 10:57:52 +0800 Subject: [PATCH] bugfix: avoid nil point --- Makefile | 6 ++++-- rpc/transform.go | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c3c43d191..43d23376e 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,10 @@ unit-test: ./rpc/. ./lock/etcdlock/... \ ./auth/simple/... \ ./cluster/calcium/... \ - ./resources/... \ - ./discovery/helium... + ./discovery/helium... \ + ./resources/storage/... \ + ./resources/volume/... \ + ./resources/cpumem/... lint: golangci-lint run diff --git a/rpc/transform.go b/rpc/transform.go index 5012bc858..e75a1b4c4 100644 --- a/rpc/transform.go +++ b/rpc/transform.go @@ -531,6 +531,9 @@ func toCoreExecuteWorkloadOptions(b *pb.ExecuteWorkloadOptions) (opts *types.Exe } func toRPCCapacityMessage(msg *types.CapacityMessage) *pb.CapacityMessage { + if msg == nil { + return nil + } caps := map[string]int64{} for nodename, capacity := range msg.NodeCapacities { caps[nodename] = int64(capacity)