Fragtality / PilotsDeck

Directly control the FlightSim from your StreamDeck!
Other
93 stars 6 forks source link

NullReferenceException when adding template "Display Gauge" to Composite Action #76

Closed pre-martin closed 1 week ago

pre-martin commented 2 weeks ago

Add a Composite Action to a button or a dial, select "Elements" in the tree and add "Display Gauge" as template.

Expected behavior: Action filled with Gauge elements.

Actual behavior: The Action Designer crashes with a NullReferenceException. See below for stack trace.

Reason: ModelDisplayElement.AddManipulator() calls ElementManipulator.CreateInstance(type, null, null). ElementManipulator.CreateInstance() accesses this third parameter (which is null):

Version: 0.8.0

Stack trace:

[ERR] [ ActionDesigner.xaml:Dispatcher_U ] Exception catched: 'System.NullReferenceException' - 'Object reference not set to an instance of an object.' - 'PilotsDeck.Actions.Advanced.Manipulators.ElementManipulator CreateInstance(PilotsDeck.Actions.Advanced.ELEMENT_MANIPULATOR, PilotsDeck.Actions.Advanced.SettingsModel.ModelManipulator, PilotsDeck.Actions.Advanced.Elements.DisplayElement)' -    at PilotsDeck.Actions.Advanced.Manipulators.ElementManipulator.CreateInstance(ELEMENT_MANIPULATOR type, ModelManipulator model, DisplayElement parent) in D:\MyProjects\FSX\PilotsDeck\PilotsDeck\Plugin\Actions\Advanced\Manipulators\ElementManipulator.cs:line 91
   at PilotsDeck.Actions.Advanced.SettingsModel.ModelDisplayElement.AddManipulator(ELEMENT_MANIPULATOR type) in D:\MyProjects\FSX\PilotsDeck\PilotsDeck\Plugin\Actions\Advanced\SettingsModel\ModelDisplayElement.cs:line 77
   at PilotsDeck.UI.ViewModels.ViewModelAction.TemplateGauge() in D:\MyProjects\FSX\PilotsDeck\PilotsDeck\Plugin\UI\ViewModels\ViewModelAction.cs:line 320
   at PilotsDeck.UI.ViewModels.ViewModelAction.SetTemplate(ActionTemplate template) in D:\MyProjects\FSX\PilotsDeck\PilotsDeck\Plugin\UI\ViewModels\ViewModelAction.cs:line 192
   at PilotsDeck.UI.ActionDesigner.ButtonSetTemplate_Click(Object sender, RoutedEventArgs e) in D:\MyProjects\FSX\PilotsDeck\PilotsDeck\Plugin\UI\ActionDesigner.xaml.cs:line 647
Fragtality commented 2 weeks ago

Good catch!

Try the Dev Build, should be fixed: https://github.com/Fragtality/PilotsDeck/blob/master/Install-PilotsDeck-latest.exe

pre-martin commented 2 weeks ago

Tested. Works fine now 👍

Fragtality commented 1 week ago

Fixed with Version 0.8.1