Don't crash if stable doesn't exist

This commit is contained in:
Jiiks 2018-01-10 17:50:26 +02:00
parent 2a29984950
commit 8688a9ea7d
3 changed files with 8 additions and 3 deletions

5
.gitignore vendored
View File

@ -15,4 +15,7 @@ Installers/dotNet/packages/
Installers/dotNet/dlls/
v2/dist/vendor/
v2/lib/static.js
**/*.suo
**/*.suo
Installers/**/*/bin
Installers/**/*/obj
Installers/**/*/packages

View File

@ -42,14 +42,14 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="asardotnetasync">
<HintPath>..\..\..\..\..\..\Projects\C#\asardotnetasync\asardotnetasync\bin\Release\asardotnetasync.dll</HintPath>
<HintPath>..\..\..\..\..\Projects\C#\asardotnetasync\asardotnetasync\bin\Release\asardotnetasync.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\..\libs\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\..\..\..\libs\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@ -73,6 +73,7 @@ namespace BetterDiscordWI.panels {
private void LocateDiscord() {
var finalPath = GetLatestVersion(cbPtb.Checked ? PtbPath : cbCanary.Checked ? CanaryPath : StablePath);
if (finalPath == string.Empty) finalPath = "Not found!";
tbPath.Text = finalPath;
_formMain.DiscordPath = finalPath;
@ -85,6 +86,7 @@ namespace BetterDiscordWI.panels {
private string GetLatestVersion(string path) {
var dirs = Directory.GetDirectories(path);
if (dirs.Length <= 0) return string.Empty;
var latest = dirs[0];
foreach (var dir in dirs) {