Skip to content

Commit f7bb1f7

Browse files
author
Coder
committed
fix(code-quality): Address event invocation and null dereference warnings
1 parent 3903119 commit f7bb1f7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

DotNetPlugin.Impl/Mcp/McpHttpServer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ private async void OnRequest ( IAsyncResult ar )
9999

100100
if ( RequestReceived != null )
101101
{
102-
await RequestReceived.Invoke ( ctx );
102+
var handler = RequestReceived;
103+
await handler.Invoke ( ctx );
103104
}
104105
else
105106
{

DotNetPlugin.Impl/Plugin.EventCallbacks.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ public static void OutputDebugString ( ref Plugins.PLUG_CB_OUTPUTDEBUGSTRING inf
105105
[EventCallback ( Plugins.CBTYPE.CB_BREAKPOINT )]
106106
public static void Breakpoint ( ref Plugins.PLUG_CB_BREAKPOINT info )
107107
{
108-
LogInfo ( $"Breakpoint " + info.breakpoint.Value.addr.ToHexString() + " in " + info.breakpoint.Value.mod );
108+
if (info.breakpoint.HasValue)
109+
{
110+
LogInfo ( $"Breakpoint " + info.breakpoint.Value.addr.ToHexString() + " in " + info.breakpoint.Value.mod );
111+
}
112+
else
113+
{
114+
LogInfo ( "Breakpoint event received, but info.breakpoint is null." );
115+
}
109116
}
110117

111118
[EventCallback ( Plugins.CBTYPE.CB_SYSTEMBREAKPOINT )]

0 commit comments

Comments
 (0)