Skip to content

Commit 00f0de7

Browse files
committed
Added extra check for non existing public and or draft versions before loading the app.
1 parent 3a1b71f commit 00f0de7

File tree

1 file changed

+18
-12
lines changed
  • Low Code App Editor_1/LCA

1 file changed

+18
-12
lines changed

Low Code App Editor_1/LCA/App.cs

+18-12
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,32 @@ public App(string path, IEngine engine)
3131
if(Settings.PublicVersion > 0)
3232
{
3333
var versionDirectory = versions.FirstOrDefault(x => x.Contains($"version_{Settings.PublicVersion}"));
34-
var versionPath = System.IO.Path.Combine(versionDirectory, "App.config.json");
35-
if (File.Exists(versionPath))
34+
if (!String.IsNullOrEmpty(versionDirectory))
3635
{
37-
var version = JsonConvert.DeserializeObject<AppVersion>(File.ReadAllText(versionPath), new TypeConverter());
38-
version.Path = versionPath;
39-
Versions.Add(version);
40-
}
36+
var versionPath = System.IO.Path.Combine(versionDirectory, "App.config.json");
37+
if (File.Exists(versionPath))
38+
{
39+
var version = JsonConvert.DeserializeObject<AppVersion>(File.ReadAllText(versionPath), new TypeConverter());
40+
version.Path = versionPath;
41+
Versions.Add(version);
42+
}
43+
}
4144
}
4245

4346
// Load latest draft version
4447
if(Settings.DraftVersion > 0)
4548
{
4649
var versionDirectory = versions.FirstOrDefault(x => x.Contains($"version_{Settings.DraftVersion}"));
47-
var versionPath = System.IO.Path.Combine(versionDirectory, "App.config.json");
48-
if (File.Exists(versionPath))
50+
if (!String.IsNullOrEmpty(versionDirectory))
4951
{
50-
var version = JsonConvert.DeserializeObject<AppVersion>(File.ReadAllText(versionPath), new TypeConverter());
51-
version.Path = versionPath;
52-
Versions.Add(version);
53-
}
52+
var versionPath = System.IO.Path.Combine(versionDirectory, "App.config.json");
53+
if (File.Exists(versionPath))
54+
{
55+
var version = JsonConvert.DeserializeObject<AppVersion>(File.ReadAllText(versionPath), new TypeConverter());
56+
version.Path = versionPath;
57+
Versions.Add(version);
58+
}
59+
}
5460
}
5561
}
5662

0 commit comments

Comments
 (0)