Skip to content

Commit

Permalink
fix: Potentially fix crash in PIN2DMD driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Jun 27, 2023
1 parent 90cc33f commit 86fc760
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LibDmd/Frame/DmdFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public DmdFrame ConvertToGray4()

switch (BitLength) {
case 2:
case 3:
return Update(FrameUtil.ConvertGrayToGray(Data, 0x0, 0x1, 0x4, 0xf), 4);
case 4:
throw new ArgumentException("Frame is already gray4.");
Expand All @@ -250,7 +251,7 @@ public DmdFrame ConvertToGray4()
case 24:
return Update(ImageUtil.ConvertToGray(Dimensions, Data, 16), 4);
default:
throw new ArgumentException("Invalid bit length.");
throw new ArgumentException($"Invalid bit length ({BitLength}).");
}
}
}
Expand Down

0 comments on commit 86fc760

Please sign in to comment.