Skip to content

Commit 568dced

Browse files
Check null
1 parent 2ba1559 commit 568dced

File tree

1 file changed

+8
-14
lines changed
  • Plugins/Flow.Launcher.Plugin.Program/Programs

1 file changed

+8
-14
lines changed

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,25 +301,19 @@ private static Win32 UrlProgram(string path)
301301
var parser = new FileIniDataParser();
302302
var data = parser.ReadFile(path);
303303
var urlSection = data["InternetShortcut"];
304-
if (urlSection != null)
304+
var url = urlSection?["URL"];
305+
foreach(var protocol in Main._settings.GetProtocols())
305306
{
306-
var url = urlSection["URL"];
307-
if(url != null)
307+
if(url.StartsWith(protocol))
308308
{
309-
foreach(var protocol in Main._settings.GetProtocols())
310-
{
311-
if(url.StartsWith(protocol))
312-
{
313-
program.LnkResolvedPath = url;
314-
program.Valid = true;
315-
break;
316-
}
317-
}
309+
program.LnkResolvedPath = url;
310+
program.Valid = true;
311+
break;
318312
}
319313
}
320314

321-
var iconPath = urlSection["IconFile"];
322-
if (Path.GetExtension(iconPath).Equals(".ico", StringComparison.OrdinalIgnoreCase))
315+
var iconPath = urlSection?["IconFile"];
316+
if (iconPath != null && Path.GetExtension(iconPath).Equals(".ico", StringComparison.OrdinalIgnoreCase))
323317
{
324318
program.IcoPath = iconPath;
325319
}

0 commit comments

Comments
 (0)