From 6d1fd0e26796ed17f0f3a0f355b151633941d6f2 Mon Sep 17 00:00:00 2001 From: spiral Date: Fri, 14 Jan 2022 19:47:12 -0500 Subject: [PATCH] fix: fix crash in API v1 when message.System is null --- PluralKit.API/Controllers/v1/MessageController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PluralKit.API/Controllers/v1/MessageController.cs b/PluralKit.API/Controllers/v1/MessageController.cs index 9e51e57a..00cfd443 100644 --- a/PluralKit.API/Controllers/v1/MessageController.cs +++ b/PluralKit.API/Controllers/v1/MessageController.cs @@ -26,6 +26,7 @@ public class MessageController: ControllerBase var msg = await _db.Execute(c => _repo.GetMessage(c, mid)); if (msg == null) return NotFound("Message not found."); - return msg.ToJson(User.ContextFor(msg.System), APIVersion.V1); + var ctx = msg.System == null ? LookupContext.ByNonOwner : User.ContextFor(msg.System); + return msg.ToJson(ctx, APIVersion.V1); } } \ No newline at end of file