Permalink
Browse files

hotfix: null pointer exceptions m(

  • Loading branch information...
lformella committed Nov 16, 2012
1 parent f84026f commit 525052de67566bad64ed04ba98c91aa5cca51785
Showing with 28 additions and 11 deletions.
  1. +28 −11 Server.Plugin.Backend.File/BackendPlugin.cs
@@ -67,53 +67,70 @@ public override Core.Servers LoadServers()
try
{
var servers = (Core.Servers) Load(Settings.Instance.AppDataPath + DataBinary);
- servers.AttachChildEvents();
- return servers;
+ if (servers != null)
+ {
+ servers.AttachChildEvents();
+ return servers;
+ }
}
catch (Exception)
{
- return new Core.Servers();
+ // skip all errors
}
+ return new Core.Servers();
}
public override Files LoadFiles()
{
try
{
var files = (Files) Load(Settings.Instance.AppDataPath + FilesBinary);
- files.AttachChildEvents();
- return files;
+ if (files != null)
+ {
+ files.AttachChildEvents();
+ return files;
+ }
}
catch (Exception)
{
- return new Files();
+ // skip all errors
}
+ return new Files();
}
public override Objects LoadSearches()
{
try
{
var searches = (Objects) Load(Settings.Instance.AppDataPath + SearchesBinary);
- searches.AttachChildEvents();
- return searches;
+ if (searches != null)
+ {
+ searches.AttachChildEvents();
+ return searches;
+ }
}
catch (Exception)
{
- return new Objects();
+ // skip all errors
}
+ return new Objects();
}
public override Snapshots LoadStatistics()
{
try
{
- return (Snapshots) Load(Settings.Instance.AppDataPath + SnapshotsBinary);
+ var snapshots = (Snapshots) Load(Settings.Instance.AppDataPath + SnapshotsBinary);
+ if (snapshots != null)
+ {
+ return snapshots;
+ }
}
catch (Exception)
{
- return new Snapshots();
+ // skip all errors
}
+ return new Snapshots();
}
#endregion

0 comments on commit 525052d

Please sign in to comment.