Implemented handling for (usually) invalid state when creating ground

This commit is contained in:
Maximilian Giller 2023-07-05 15:21:45 +02:00
parent 762b163655
commit b4eeb90ce9

View file

@ -97,7 +97,8 @@ void CollectableSimGround::createSegment(float leftCorner, float rightCorner,
{
if (leftCorner > rightCorner)
{
throw std::runtime_error("Left corner must be less than right corner");
// Segment would have negative width, don't create it and leave empty instead
return;
}
if (segment == nullptr)