Skip to content

Commit 41886bd

Browse files
authored
fix: prevent crash in Holistic Landmarker when face is lost (#1418)
1 parent dbc617c commit 41886bd

File tree

1 file changed

+8
-1
lines changed
  • Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/HolisticLandmarker

1 file changed

+8
-1
lines changed

Packages/com.github.homuler.mediapipe/Runtime/Scripts/Tasks/Vision/HolisticLandmarker/HolisticLandmarker.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,14 @@ private static bool TryBuildHolisticLandmarkerResult(PacketMap outputPackets, re
346346

347347
using var faceBlendshapesPacket = outputPackets.At<Classifications>(_FACE_BLENDSHAPES_STREAM_NAME);
348348
var faceBlendshapes = result.faceBlendshapes;
349-
faceBlendshapesPacket?.Get(ref faceBlendshapes);
349+
if (faceBlendshapesPacket == null || faceBlendshapesPacket.IsEmpty())
350+
{
351+
faceBlendshapes.categories?.Clear();
352+
}
353+
else
354+
{
355+
faceBlendshapesPacket.Get(ref faceBlendshapes);
356+
}
350357

351358
using var segmentationMaskPacket = outputPackets.At<Image>(_POSE_SEGMENTATION_MASK_STREAM_NAME);
352359
var segmentationMask = segmentationMaskPacket?.Get();

0 commit comments

Comments
 (0)