This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 6c6a0f471 fix: unmarshal connections fail (#5516)
6c6a0f471 is described below

commit 6c6a0f471964fae2c3252230e3929e515f031418
Author: abeizn <[email protected]>
AuthorDate: Mon Jun 19 13:57:42 2023 +0800

    fix: unmarshal connections fail (#5516)
    
    * fix: unmarshal connections fail
    
    * fix: unmarshal connection notes
---
 backend/core/models/blueprint.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/backend/core/models/blueprint.go b/backend/core/models/blueprint.go
index 6bbc04ead..a657c005e 100644
--- a/backend/core/models/blueprint.go
+++ b/backend/core/models/blueprint.go
@@ -55,9 +55,12 @@ type BlueprintSettings struct {
        AfterPlan   json.RawMessage `json:"after_plan"`
 }
 
-// UpdateConnections unmarshals the connections on this BlueprintSettings
+// UnmarshalConnections unmarshals the connections on this BlueprintSettings 
reference
 func (bps *BlueprintSettings) UnmarshalConnections() 
([]*plugin.BlueprintConnectionV200, errors.Error) {
        var connections []*plugin.BlueprintConnectionV200
+       if bps.Connections == nil {
+               return nil, nil
+       }
        err := json.Unmarshal(bps.Connections, &connections)
        if err != nil {
                return nil, errors.Default.Wrap(err, `unmarshal connections 
fail`)

Reply via email to