From e9f05d28ddff17c5ccdc969c189b11e3a6901d7d Mon Sep 17 00:00:00 2001 From: "Chang, Hui-Tang" Date: Fri, 5 Apr 2024 16:42:17 +0800 Subject: [PATCH] fix: improve nil check --- Makefile | 5 +---- pkg/service/convert.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 34e604e1e..5ca38157f 100644 --- a/Makefile +++ b/Makefile @@ -17,15 +17,12 @@ dev: ## Run dev container @docker run -d --rm \ -e DOCKER_HOST=tcp://${SOCAT_HOST}:${SOCAT_PORT} \ -v $(PWD):/${SERVICE_NAME} \ - -v $(PWD)/../go.work:/go.work \ - -v $(PWD)/../go.work.sum:/go.work.sum \ - -v $(PWD)/../component:/component \ -v vdp:/vdp \ -v airbyte:/airbyte \ -p ${SERVICE_PORT}:${SERVICE_PORT} \ --network instill-network \ --name ${SERVICE_NAME} \ - instill/${SERVICE_NAME}:dev + instill/${SERVICE_NAME}:dev >/dev/null 2>&1 .PHONY: logs logs: ## Tail container logs with -n 10 diff --git a/pkg/service/convert.go b/pkg/service/convert.go index 69e2736ed..4f0c8c2c7 100644 --- a/pkg/service/convert.go +++ b/pkg/service/convert.go @@ -303,7 +303,7 @@ func (s *service) includeOperatorComponentDetail(ctx context.Context, comp *pipe func (s *service) includeConnectorComponentDetail(ctx context.Context, comp *pipelinePB.ConnectorComponent, connectors map[uuid.UUID]*datamodel.Connector) error { if comp.ConnectorName != "" { conn, ok := connectors[uuid.FromStringOrNil(strings.Split(comp.ConnectorName, "/")[1])] - if !ok { + if !ok || conn == nil { // Allow the connector to not exist instead of returning an error. comp.Connector = nil } else {