takuya-takeuchi / FaceRecognitionDotNet

The world's simplest facial recognition api for .NET on Windows, MacOS and Linux
MIT License
1.26k stars 308 forks source link

Bug: HeadPose.Equals throws NullReferenceException #234

Open HEGIT-TBL opened 1 year ago

HEGIT-TBL commented 1 year ago

Installed product versions

Product Type Name Version
Visual Studio VS 2022 community v17.7.4
NuGet Package FaceRecognitionDotNet.CUDA112 v1.3.0.7

Description

HeadPose's equality method/methods do not take null into consideration and throw System.NullReferenceException.

Steps to recreate

Run the following code with NuGet package installed

using FaceRecognitionDotNet;

HeadPose hp = null;
var isNull = hp == null;

Expected behavior

As per MSDN:

Implementations of Equals must not throw exceptions; they should always return a value.

So in this case hp == null should return true

Current behavior

hp == null throws System.NullReferenceException at FaceRecognitionDotNet.HeadPose.op_Equality(HeadPose pose1, HeadPose pose2)