From ac709a1205942b104c7dc7c223b45ec341dd33c6 Mon Sep 17 00:00:00 2001 From: ewin Date: Thu, 6 Mar 2025 09:47:32 -0500 Subject: [PATCH] Handle nil statuses in processContentType --- internal/processing/status/edit.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/processing/status/edit.go b/internal/processing/status/edit.go index 2b87307d4..f426ab944 100644 --- a/internal/processing/status/edit.go +++ b/internal/processing/status/edit.go @@ -359,12 +359,14 @@ func processContentType( case form.ContentType != "": return typeutils.APIContentTypeToContentType(form.ContentType) - // No content type on the form, return the status's current content type. - case status.ContentType != 0: + // No content type on the form, return the existing + // status's current content type if there is one. + case status != nil && status.ContentType != 0: return status.ContentType - // Old statuses may not have a saved content type; - // return the user's default content type preference. + // We aren't editing an existing status, or if we are + // it's an old one that doesn't have a saved content + // type. Use the user's default content type setting. case accountDefaultContentType != "": return typeutils.APIContentTypeToContentType(apimodel.StatusContentType(accountDefaultContentType))