Skip to content

Commit de2feba

Browse files
committed
v2.0.1 - Fixed NPE due to coordinates not being passed in MultiAction
1 parent 1e656cb commit de2feba

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

barraider-sdtools/PluginContainer.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private async void Connection_OnKeyDown(object sender, StreamDeckEventReceivedEv
7575
{
7676
if (instances.ContainsKey(e.Event.Context))
7777
{
78-
KeyPayload payload = new KeyPayload(new KeyCoordinates() { Column = e.Event.Payload.Coordinates.Columns, Row = e.Event.Payload.Coordinates.Rows },
78+
KeyPayload payload = new KeyPayload(GenerateKeyCoordinates(e.Event.Payload.Coordinates),
7979
e.Event.Payload.Settings, e.Event.Payload.State, e.Event.Payload.UserDesiredState, e.Event.Payload.IsInMultiAction);
8080
instances[e.Event.Context].KeyPressed(payload);
8181
}
@@ -94,7 +94,7 @@ private async void Connection_OnKeyUp(object sender, StreamDeckEventReceivedEven
9494
{
9595
if (instances.ContainsKey(e.Event.Context))
9696
{
97-
KeyPayload payload = new KeyPayload(new KeyCoordinates() { Column = e.Event.Payload.Coordinates.Columns, Row = e.Event.Payload.Coordinates.Rows },
97+
KeyPayload payload = new KeyPayload(GenerateKeyCoordinates(e.Event.Payload.Coordinates),
9898
e.Event.Payload.Settings, e.Event.Payload.State, e.Event.Payload.UserDesiredState, e.Event.Payload.IsInMultiAction);
9999
instances[e.Event.Context].KeyReleased(payload);
100100
}
@@ -134,7 +134,7 @@ private async void Connection_OnWillAppear(object sender, StreamDeckEventReceive
134134
{
135135
try
136136
{
137-
InitialPayload payload = new InitialPayload(new KeyCoordinates() { Column = e.Event.Payload.Coordinates.Columns, Row = e.Event.Payload.Coordinates.Rows },
137+
InitialPayload payload = new InitialPayload(GenerateKeyCoordinates(e.Event.Payload.Coordinates),
138138
e.Event.Payload.Settings, e.Event.Payload.State, e.Event.Payload.IsInMultiAction, deviceInfo);
139139
instances[e.Event.Context] = (PluginBase)Activator.CreateInstance(supportedActions[e.Event.Action], conn, payload);
140140
}
@@ -217,5 +217,15 @@ private void Connection_OnDisconnected(object sender, EventArgs e)
217217
Logger.Instance.LogMessage(TracingLevel.INFO, "Disconnect event received");
218218
disconnectEvent.Set();
219219
}
220+
221+
private KeyCoordinates GenerateKeyCoordinates(Coordinates coordinates)
222+
{
223+
if (coordinates == null)
224+
{
225+
return null;
226+
}
227+
228+
return new KeyCoordinates() { Column = coordinates.Columns, Row = coordinates.Rows };
229+
}
220230
}
221231
}

barraider-sdtools/barraider-sdtools.csproj

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
55
<Authors>BarRaider</Authors>
66
<Product>StreamDeck Tools by BarRaider</Product>
7-
<Description>Start developing your Elgato StreamDeck plugin faster!
8-
This library holds all the basic logic of setting up the framework, so that you can focus on writing the logic of the plugin itself. [Samples for using the library are provided here: https://github.com/BarRaider/barraider-sdtools]
9-
Using this library, you only need to derive from the abstract PluginBase class and add one line of code in your program.cs to have a working plugin. More information here: https://github.com/BarRaider/barraider-sdtools</Description>
7+
<Description>Start developing your Elgato StreamDeck plugin faster!
8+
This library encapsulates all the overhead of setting up the framework, so that you can focus on writing the logic of the plugin itself.
9+
[Samples for using the library are provided here: https://github.com/BarRaider/streamdeck-tools]
10+
Using this library, you only need to derive from the abstract PluginBase class and add one line of code in your program.cs to have a working plugin. More info and working samples here: https://github.com/BarRaider/streamdeck-tools .
11+
Feel free to contact me for more information: https://barraider.github.io</Description>
1012
<Copyright>Copyright © BarRaider 2019</Copyright>
1113
<PackageLicenseUrl>https://github.com/BarRaider/streamdeck-tools/blob/master/LICENSE</PackageLicenseUrl>
1214
<PackageProjectUrl>https://github.com/BarRaider/streamdeck-tools</PackageProjectUrl>
1315
<RepositoryUrl>https://github.com/BarRaider/streamdeck-tools</RepositoryUrl>
1416
<PackageTags>StreamDeck Elgato Library Plugin Stream Deck</PackageTags>
1517
<PackageId>StreamDeck-Tools</PackageId>
1618
<PackageIconUrl>https://raw.githubusercontent.com/BarRaider/barraider.github.io/master/images/BRLogo.png</PackageIconUrl>
17-
<AssemblyVersion>2.0.0.0</AssemblyVersion>
18-
<FileVersion>2.0.0.0</FileVersion>
19-
<Version>2.0.0</Version>
20-
<PackageReleaseNotes>Note: Library has been optimized for the new 4.1 SDK!
19+
<AssemblyVersion>2.0.1.0</AssemblyVersion>
20+
<FileVersion>2.0.1.0</FileVersion>
21+
<Version>2.0.1</Version>
22+
<PackageReleaseNotes>2.0.1 - Fixed bug which caused issues when adding plugins to MultiActions
23+
24+
Note: Library has been optimized for the new 4.1 SDK!
25+
2126
Some of the changes are breaking existing interfaces. Upgrade instruction are available on the Github page:
2227
https://github.com/BarRaider/streamdeck-tools
2328
Added new functionality + more data to existing methods. Plugin creation is now much easier</PackageReleaseNotes>

0 commit comments

Comments
 (0)