fivem
fivem copied to clipboard
"==" throwing null reference exception on Models which are null
As discovered by: https://canary.discord.com/channels/192358910387159041/553225456296525833/948031244967510067
https://github.com/citizenfx/fivem/blob/cbe56f78f86bebb68d7960a38c3cdc31c7d76790/code/client/clrcore/External/Model.cs#L405-L408 Will throw an exception if left is null since null.Equals() does not exist.
This would fix the issue:
public static bool operator ==(Model left, Model right)
{
if (left == null)
return right == null;
return left.Equals(right);
}
https://github.com/citizenfx/fivem/blob/cbe56f78f86bebb68d7960a38c3cdc31c7d76790/code/client/clrcore/External/Model.cs#L405-L408 This would also need to be implemented on the negation:
public static bool operator !=(Model left, Model right)
{
return !(left==right);
}
Wouldn't it be easier if you'd make a PR for this?
Sent from ProtonMail for iOS
On Wed, Mar 2, 2022 at 04:52, Keyinator @.***> wrote:
https://github.com/citizenfx/fivem/blob/cbe56f78f86bebb68d7960a38c3cdc31c7d76790/code/client/clrcore/External/Model.cs#L405-L408 This would also need to be implemented on the negation:
public static bool operator !=(Model left, Model right) { return !(left==right); }
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Wouldn't it be easier if you'd make a PR for this? Sent from ProtonMail for iOS … On Wed, Mar 2, 2022 at 04:52, Keyinator @.> wrote: https://github.com/citizenfx/fivem/blob/cbe56f78f86bebb68d7960a38c3cdc31c7d76790/code/client/clrcore/External/Model.cs#L405-L408 This would also need to be implemented on the negation: public static bool operator !=(Model left, Model right) { return !(left==right); } — Reply to this email directly, [view it on GitHub](#1312 (comment)), or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>
Done. #1313