adds try/catch for Null Reference Exceptions

This commit is contained in:
Andrew Welker
2020-04-20 12:21:18 -06:00
parent c7e33b5682
commit 563f690277
2 changed files with 12 additions and 2 deletions

View File

@@ -56,7 +56,16 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key);
var advDev = device as IBridgeAdvanced;
advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null);
try
{
advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null);
}
catch (NullReferenceException)
{
Debug.ConsoleWithLog(0, this,
"Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key);
}
//if (device.GetType().GetCType().IsAssignableFrom(typeof (IBridge)))
//{
// var bridge = device as IBridge;

View File

@@ -360,7 +360,8 @@ namespace PepperDash.Essentials
}
catch (Exception e)
{
Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly. Exception: {1}", loadedAssembly.Name, e);
Debug.Console(2, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}",
loadedAssembly.Name, e, type.Name);
continue;
}