Skip to content

Vector3d.Equals(object ) will throw if passed an object that isn't a Vector3d #325

@gotmachine

Description

@gotmachine

Stupid mistake is stupid :

public override bool Equals(object other)
{
	if (!(other is Vector3)) // should be Vector3d
		return false;

	Vector3d vector3d = (Vector3d)other; // InvalidCastException when other isn't a Vector3d

	if (x.Equals(vector3d.x) && y.Equals(vector3d.y))
		return z.Equals(vector3d.z);

	return false;
}

Notably can cause issues for boxed Vector3d instances when inside object collections (which is a weird use case, but still).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kspBugIdentified KSP issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions