fix(relay): initialize TaskRelayInfo
This commit is contained in:
parent
13d14dc8a8
commit
3963863eb0
@ -24,6 +24,10 @@ Task 任务通过平台、Action 区分任务
|
|||||||
*/
|
*/
|
||||||
func RelayTaskSubmit(c *gin.Context, info *relaycommon.RelayInfo) (taskErr *dto.TaskError) {
|
func RelayTaskSubmit(c *gin.Context, info *relaycommon.RelayInfo) (taskErr *dto.TaskError) {
|
||||||
info.InitChannelMeta(c)
|
info.InitChannelMeta(c)
|
||||||
|
// ensure TaskRelayInfo is initialized to avoid nil dereference when accessing embedded fields
|
||||||
|
if info.TaskRelayInfo == nil {
|
||||||
|
info.TaskRelayInfo = &relaycommon.TaskRelayInfo{}
|
||||||
|
}
|
||||||
platform := constant.TaskPlatform(c.GetString("platform"))
|
platform := constant.TaskPlatform(c.GetString("platform"))
|
||||||
if platform == "" {
|
if platform == "" {
|
||||||
platform = GetTaskPlatform(c)
|
platform = GetTaskPlatform(c)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user