File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,16 @@ func postTransfers(c *gin.Context) {
6767 StartOnCompletion : false ,
6868 })
6969 if err != nil {
70- if err := manager .Client ().SetTransferStatus (context .Background (), trnsfr .Server .ID (), false ); err != nil {
71- trnsfr .Log ().WithField ("status" , false ).WithError (err ).Error ("failed to set transfer status" )
70+ if trnsfr .Server != nil {
71+ if err := manager .Client ().SetTransferStatus (context .Background (), trnsfr .Server .ID (), false ); err != nil {
72+ trnsfr .Log ().WithField ("status" , false ).WithError (err ).Error ("failed to set transfer status" )
73+ }
74+ } else {
75+ // No server instance yet, so just log the failure without trying to update status
76+ // Else this will cause: invalid memory address or nil pointer dereference
77+ trnsfr .Log ().WithError (err ).Error ("failed to initialize transfer; no server instance created" )
7278 }
79+
7380 middleware .CaptureAndAbort (c , err )
7481 return
7582 }
You can’t perform that action at this time.
0 commit comments