Skip to content

Commit 6911eb1

Browse files
authored
fix nullpo when motdurl is null (#195)
* fix nullpo when motdurl is null * prolly better
1 parent 03f67e3 commit 6911eb1

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎Essentials/EssentialsPlugin.cs‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,10 @@ public void SendMotd(MyPlayer player, bool onSessionChanged)
275275
{
276276
long playerId = player.Identity.IdentityId;
277277

278-
var motdUrl = MyGuiSandbox.IsUrlWhitelisted(Config.MotdUrl)
279-
? Config.MotdUrl
280-
: $"https://steamcommunity.com/linkfilter/?url={Config.MotdUrl}";
281-
282278
if (!string.IsNullOrEmpty(Config.MotdUrl) && !Config.NewUserMotdUrl)
283279
{
284-
MyVisualScriptLogicProvider.OpenSteamOverlay(motdUrl, playerId);
280+
var url = MakeUrl(Config.MotdUrl);
281+
MyVisualScriptLogicProvider.OpenSteamOverlay(url, playerId);
285282
return;
286283
}
287284

@@ -298,7 +295,8 @@ public void SendMotd(MyPlayer player, bool onSessionChanged)
298295

299296
if (!string.IsNullOrEmpty(Config.MotdUrl) && isNewUser && Config.NewUserMotdUrl)
300297
{
301-
MyVisualScriptLogicProvider.OpenSteamOverlay(motdUrl, playerId);
298+
var url = MakeUrl(Config.MotdUrl);
299+
MyVisualScriptLogicProvider.OpenSteamOverlay(url, playerId);
302300
return;
303301
}
304302

@@ -324,6 +322,12 @@ public void SendMotd(MyPlayer player, bool onSessionChanged)
324322
}
325323
}
326324

325+
static string MakeUrl(string url)
326+
{
327+
if (MyGuiSandbox.IsUrlWhitelisted(url)) return url;
328+
return $"https://steamcommunity.com/linkfilter/?url={url}";
329+
}
330+
327331
static string GetDefaultMotdText()
328332
{
329333
try

0 commit comments

Comments
 (0)