Skip to content

Commit 9217d19

Browse files
author
satoo air
committed
Fix IndexOutOfRangeException: Array index is out of range.
1 parent 3c222dd commit 9217d19

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MultiSourceFrameSample.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ void Update ()
167167

168168
int index = x + y * width;
169169

170-
if (bodyIndexData [(int)depthSpacePoints [index].X + (int)depthSpacePoints [index].Y * depthWidth] == 255) {
170+
int tmp = ((int)depthSpacePoints [index].X + (int)depthSpacePoints [index].Y * depthWidth < 0) ? 0 : (int)depthSpacePoints [index].X + (int)depthSpacePoints [index].Y * depthWidth;
171+
172+
if (bodyIndexData [tmp] == 255) {
171173
maskData [index] = 0;
172174
} else {
173175
maskData [index] = 255;

0 commit comments

Comments
 (0)