Fix server NRE in console command completions.

Happens if you just type "tp:to<space>" into the console.

Toolshed can fail to provide completion results, in which case a null propagates and possibly crashes the server.
This commit is contained in:
Pieter-Jan Briers
2024-01-08 11:17:38 +01:00
parent da2a2ce4ff
commit c68b3dccb7
3 changed files with 5 additions and 3 deletions

View File

@@ -44,6 +44,7 @@ END TEMPLATE-->
### Bugfixes
* Fix `IClipboardManager.GetText()` returning null in some cases.
* Fix possible NRE in server-side console command completion code.
### Other

View File

@@ -259,6 +259,9 @@ namespace Robust.Server.Console
}
done:
result ??= CompletionResult.Empty;
var msg = new MsgConCompletionResp
{
Result = result,

View File

@@ -4,14 +4,12 @@ using Robust.Shared.Serialization;
namespace Robust.Shared.Network.Messages;
#nullable disable
public sealed class MsgConCompletionResp : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.Command;
public int Seq { get; set; }
public CompletionResult Result { get; set; }
public CompletionResult Result { get; set; } = default!;
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
{