From 0333a7ba48bb5c5c28d8eaf1d94e5dd6d990534f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 25 二月 2026 18:08:26 +0800
Subject: [PATCH] 0312 AI优化代码

---
 Main/System/Message/RichTextMgr.cs |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/Main/System/Message/RichTextMgr.cs b/Main/System/Message/RichTextMgr.cs
index 991ffca..eba10fc 100644
--- a/Main/System/Message/RichTextMgr.cs
+++ b/Main/System/Message/RichTextMgr.cs
@@ -153,7 +153,20 @@
 
     public bool ExecuteEvent(RichTextEventEnum type,HrefInfo href)
     {
-        return m_RichEvents[type].Execute(type,href);
+        if (m_RichEvents == null || !m_RichEvents.ContainsKey(type))
+        {
+            Debug.LogWarning($"RichTextMgr: Event type {type} not registered");
+            return false;
+        }
+
+        var evt = m_RichEvents[type];
+        if (evt == null)
+        {
+            Debug.LogWarning($"RichTextMgr: Event handler for {type} is null");
+            return false;
+        }
+
+        return evt.Execute(type, href);
     }
 
     public string GetDisplay(RichTextEventEnum type,Dictionary<string,string> dic)

--
Gitblit v1.8.0