Skip to content

Commit 86fc760

Browse files
committed
fix: Potentially fix crash in PIN2DMD driver.
1 parent 90cc33f commit 86fc760

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

LibDmd/Frame/DmdFrame.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ public DmdFrame ConvertToGray4()
242242

243243
switch (BitLength) {
244244
case 2:
245+
case 3:
245246
return Update(FrameUtil.ConvertGrayToGray(Data, 0x0, 0x1, 0x4, 0xf), 4);
246247
case 4:
247248
throw new ArgumentException("Frame is already gray4.");
@@ -250,7 +251,7 @@ public DmdFrame ConvertToGray4()
250251
case 24:
251252
return Update(ImageUtil.ConvertToGray(Dimensions, Data, 16), 4);
252253
default:
253-
throw new ArgumentException("Invalid bit length.");
254+
throw new ArgumentException($"Invalid bit length ({BitLength}).");
254255
}
255256
}
256257
}

0 commit comments

Comments
 (0)