mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 03:07:27 +00:00
fix(relay): initialize TaskRelayInfo
This commit is contained in:
@@ -24,6 +24,10 @@ Task 任务通过平台、Action 区分任务
|
||||
*/
|
||||
func RelayTaskSubmit(c *gin.Context, info *relaycommon.RelayInfo) (taskErr *dto.TaskError) {
|
||||
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"))
|
||||
if platform == "" {
|
||||
platform = GetTaskPlatform(c)
|
||||
|
||||
Reference in New Issue
Block a user