@@ -135,7 +135,7 @@ func (impl AppListingRepositoryImpl) FetchAppsByEnvironment(appListingFilter hel
135135
136136 if len (item .DataSource ) > 0 {
137137 mInfo , err := parseMaterialInfo ([]byte (item .MaterialInfoJson ), item .DataSource )
138- if err == nil {
138+ if err == nil && len ( mInfo ) > 0 {
139139 item .MaterialInfo = mInfo
140140 } else {
141141 item .MaterialInfo = []byte ("[]" )
@@ -176,7 +176,7 @@ func (impl AppListingRepositoryImpl) DeploymentDetailsByAppIdAndEnvId(appId int,
176176 }
177177
178178 mInfo , err := parseMaterialInfo (deploymentDetail .MaterialInfo , deploymentDetail .DataSource )
179- if err == nil {
179+ if err == nil && len ( mInfo ) > 0 {
180180 deploymentDetail .MaterialInfo = mInfo
181181 } else {
182182 deploymentDetail .MaterialInfo = []byte ("[]" )
@@ -186,6 +186,11 @@ func (impl AppListingRepositoryImpl) DeploymentDetailsByAppIdAndEnvId(appId int,
186186}
187187
188188func parseMaterialInfo (materialInfo json.RawMessage , source string ) (json.RawMessage , error ) {
189+ defer func () {
190+ if r := recover (); r != nil {
191+ fmt .Printf ("PARSEMATERIALINFO_MATERIAL_RECOVER, materialInfo: %s, source: %s, err: %s \n " , materialInfo , source , r )
192+ }
193+ }()
189194 if source != "GOCD" && source != "CI-RUNNER" && source != "EXTERNAL" {
190195 return nil , fmt .Errorf ("datasource: %s not supported" , source )
191196 }
@@ -342,7 +347,7 @@ func (impl AppListingRepositoryImpl) FetchAppTriggerView(appId int) ([]bean.Trig
342347 item .DataSource = tView .DataSource
343348 item .MaterialInfo = tView .MaterialInfo
344349 mInfo , err := parseMaterialInfo (tView .MaterialInfo , tView .DataSource )
345- if err == nil {
350+ if err == nil && len ( mInfo ) > 0 {
346351 item .MaterialInfo = mInfo
347352 } else {
348353 item .MaterialInfo = []byte ("[]" )
0 commit comments