]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Update ActionAlertTooltip.cs to use TryFromMarkup (#29975)
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Sat, 13 Jul 2024 04:05:51 +0000 (07:05 +0300)
committerGitHub <noreply@github.com>
Sat, 13 Jul 2024 04:05:51 +0000 (14:05 +1000)
Content.Client/Actions/UI/ActionAlertTooltip.cs

index ddc498b6e91296faeb8243b0c93a6524d0a1bfd7..f805f6643d2fad2461397a21152a9e7f49d87f4c 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Client.Stylesheets;
+using Content.Client.Stylesheets;
 using Robust.Client.UserInterface.Controls;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
@@ -77,9 +77,12 @@ namespace Content.Client.Actions.UI
                     MaxWidth = TooltipTextMaxWidth,
                     StyleClasses = {StyleNano.StyleClassTooltipActionRequirements}
                 };
-                requiresLabel.SetMessage(FormattedMessage.FromMarkup("[color=#635c5c]" +
-                                                                     requires +
-                                                                     "[/color]"));
+
+                if (!FormattedMessage.TryFromMarkup("[color=#635c5c]" + requires + "[/color]", out var markup))
+                    return;
+
+                requiresLabel.SetMessage(markup);
+
                 vbox.AddChild(requiresLabel);
             }
         }
@@ -97,8 +100,11 @@ namespace Content.Client.Actions.UI
             if (timeLeft > TimeSpan.Zero)
             {
                 var duration = Cooldown.Value.End - Cooldown.Value.Start;
-                _cooldownLabel.SetMessage(FormattedMessage.FromMarkup(
-                    $"[color=#a10505]{(int) duration.TotalSeconds} sec cooldown ({(int) timeLeft.TotalSeconds + 1} sec remaining)[/color]"));
+
+                if (!FormattedMessage.TryFromMarkup($"[color=#a10505]{(int) duration.TotalSeconds} sec cooldown ({(int) timeLeft.TotalSeconds + 1} sec remaining)[/color]", out var markup))
+                    return;
+
+                _cooldownLabel.SetMessage(markup);
                 _cooldownLabel.Visible = true;
             }
             else