mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 20:17:03 +00:00
Add safety check for casting device into interface
(device as IRoutingInputsOutputs).InputPorts will throw Exception on accessing InputPorts property if device do not implement such interface.
This commit is contained in:
parent
522c107ce6
commit
08fe408dc1
1 changed files with 3 additions and 3 deletions
|
|
@ -360,9 +360,9 @@ namespace PepperDash.Essentials.Core
|
|||
{
|
||||
var device = GetDeviceForKey(s);
|
||||
|
||||
if (device == null) return;
|
||||
var inputPorts = (device as IRoutingInputsOutputs).InputPorts;
|
||||
var outputPorts = (device as IRoutingInputsOutputs).OutputPorts;
|
||||
if (device == null) return;
|
||||
var inputPorts = ((device as IRoutingInputs) != null) ? (device as IRoutingInputs).InputPorts : null;
|
||||
var outputPorts = ((device as IRoutingOutputs) != null) ? (device as IRoutingOutputs).OutputPorts : null;
|
||||
if (inputPorts != null)
|
||||
{
|
||||
Debug.Console(0, "Device {0} has {1} Input Ports:", s, inputPorts.Count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue