Skip to content

Commit 3be180b

Browse files
committed
[修改]1. 修改空判断为函数调用
1 parent 5190906 commit 3be180b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

GameFrameX.Core/Hotfix/HotfixModule.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private void ParseDll()
152152
&& !AddTcpHandler(type)
153153
&& !AddHttpHandler(type))
154154
{
155-
if ((HotfixBridge == null && type.GetInterface(fullName) != null))
155+
if ((HotfixBridge.IsNull() && type.GetInterface(fullName) != null))
156156
{
157157
var bridge = (IHotfixBridge)Activator.CreateInstance(type);
158158

@@ -172,7 +172,7 @@ private bool AddHttpHandler(Type type)
172172
}
173173

174174
var attr = (HttpMessageMappingAttribute)type.GetCustomAttribute(typeof(HttpMessageMappingAttribute));
175-
if (attr == null)
175+
if (attr.IsNull())
176176
{
177177
// 不是最终实现类
178178
return true;
@@ -197,7 +197,7 @@ private bool AddHttpHandler(Type type)
197197
private bool AddRpcHandler(Type type)
198198
{
199199
var attribute = (MessageRpcMappingAttribute)type.GetCustomAttribute(typeof(MessageRpcMappingAttribute), true);
200-
if (attribute == null)
200+
if (attribute.IsNull())
201201
{
202202
return false;
203203
}
@@ -217,13 +217,13 @@ private bool AddRpcHandler(Type type)
217217
private bool AddTcpHandler(Type type)
218218
{
219219
var attribute = (MessageMappingAttribute)type.GetCustomAttribute(typeof(MessageMappingAttribute), true);
220-
if (attribute == null)
220+
if (attribute.IsNull())
221221
{
222222
return false;
223223
}
224224

225225
var msgIdField = (MessageTypeHandlerAttribute)attribute.MessageType.GetCustomAttribute(typeof(MessageTypeHandlerAttribute), true);
226-
if (msgIdField == null)
226+
if (msgIdField.IsNull())
227227
{
228228
return false;
229229
}
@@ -348,12 +348,12 @@ internal T GetAgent<T>(BaseComponent component) where T : IComponentAgent
348348
}
349349
}
350350

351-
if (agent == null)
351+
if (agent.IsNull())
352352
{
353353
agent = (T)Activator.CreateInstance(agentType);
354354
}
355355

356-
if (agent == null)
356+
if (agent.IsNull())
357357
{
358358
throw new ArgumentNullException(nameof(agent));
359359
}

0 commit comments

Comments
 (0)