From 9224ada1ec154d1d50687fba15782f07ab435ab7 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 17 Jul 2026 13:51:41 +0800
Subject: [PATCH] fix(gateApi): 修复网格交易服务中的空指针异常

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
index 5249c57..6b06c95 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1221,7 +1221,8 @@
                                     });
                                 }
                             }
-                            cancelCursor = GridElement.findById(cancelCursor.getUpId());
+                            Integer nextUpId = cancelCursor.getUpId();
+                            cancelCursor = nextUpId != null ? GridElement.findById(nextUpId) : null;
                         }
 //                        log.info("[Gate-2] 多仓仓位归零 空仓队列触发, 匹配:{},当前价:{}", matched, currentPrice);
                         if (!newEntryGrid.isHasLongOrder()) {
@@ -1275,7 +1276,8 @@
                                     });
                                 }
                             }
-                            cancelCursor = GridElement.findById(cancelCursor.getDownId());
+                            Integer nextDownId = cancelCursor.getDownId();
+                            cancelCursor = nextDownId != null ? GridElement.findById(nextDownId) : null;
                         }
 //                        log.info("[Gate-4] 空仓仓位归零 多仓队列触发, 匹配:{},当前价:{}", matched, currentPrice);
                         if (!newEntryGrid.isHasShortOrder()){

--
Gitblit v1.9.1