Skip to content

Commit

Permalink
[修改]1. 修改空判断为函数调用
Browse files Browse the repository at this point in the history
  • Loading branch information
AlianBlank committed Nov 23, 2024
1 parent 5190906 commit 3be180b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions GameFrameX.Core/Hotfix/HotfixModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void ParseDll()
&& !AddTcpHandler(type)
&& !AddHttpHandler(type))
{
if ((HotfixBridge == null && type.GetInterface(fullName) != null))
if ((HotfixBridge.IsNull() && type.GetInterface(fullName) != null))
{
var bridge = (IHotfixBridge)Activator.CreateInstance(type);

Expand All @@ -172,7 +172,7 @@ private bool AddHttpHandler(Type type)
}

var attr = (HttpMessageMappingAttribute)type.GetCustomAttribute(typeof(HttpMessageMappingAttribute));
if (attr == null)
if (attr.IsNull())
{
// 不是最终实现类
return true;
Expand All @@ -197,7 +197,7 @@ private bool AddHttpHandler(Type type)
private bool AddRpcHandler(Type type)
{
var attribute = (MessageRpcMappingAttribute)type.GetCustomAttribute(typeof(MessageRpcMappingAttribute), true);
if (attribute == null)
if (attribute.IsNull())
{
return false;
}
Expand All @@ -217,13 +217,13 @@ private bool AddRpcHandler(Type type)
private bool AddTcpHandler(Type type)
{
var attribute = (MessageMappingAttribute)type.GetCustomAttribute(typeof(MessageMappingAttribute), true);
if (attribute == null)
if (attribute.IsNull())
{
return false;
}

var msgIdField = (MessageTypeHandlerAttribute)attribute.MessageType.GetCustomAttribute(typeof(MessageTypeHandlerAttribute), true);
if (msgIdField == null)
if (msgIdField.IsNull())
{
return false;
}
Expand Down Expand Up @@ -348,12 +348,12 @@ internal T GetAgent<T>(BaseComponent component) where T : IComponentAgent
}
}

if (agent == null)
if (agent.IsNull())
{
agent = (T)Activator.CreateInstance(agentType);
}

if (agent == null)
if (agent.IsNull())
{
throw new ArgumentNullException(nameof(agent));
}
Expand Down

0 comments on commit 3be180b

Please sign in to comment.