Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Earcut crashes in certain cases. #252

Closed
mihakrajnc opened this issue Sep 22, 2017 · 4 comments
Closed

Earcut crashes in certain cases. #252

mihakrajnc opened this issue Sep 22, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@mihakrajnc
Copy link

I'm having problems loading a map with the new Earcut dependency. In some cases, the map loads ok, but in other cases it crashes with a NPE.

The crash occurs on this line:

https://github.com/mapbox/mapbox-unity-sdk/blob/develop/sdkproject/Assets/Mapbox/Unity/MeshGeneration/Modifiers/MeshModifiers/Earcut.cs#L490

It looks like there is a null check there, but it does nothing. This seems to be the issue: mapbox/earcut#87

A simple fix for this is to modily the EliminateHoles method like this:

// process holes from left to right
for (i = 0; i < queue.Count; i++)
{
	EliminateHole(queue[i], outerNode);

	Node filterPointsNode = FilterPoints(outerNode, outerNode.next);

	if (filterPointsNode == null) break;

	outerNode = filterPointsNode;
}

But I don't know how correct is this, or what the implications of the change are... Any suggestions?

@david-rhodes
Copy link

cc @brnkhy

@brnkhy
Copy link
Contributor

brnkhy commented Sep 22, 2017

@mihakrajnc I never had such a problem, can you share a sample lat/lng to test it out as well?

@david-rhodes
Copy link

@mihakrajnc any updates here?

Can you share a sample lat/lng to test it out as well?

@MiroMuse MiroMuse added this to the S17.4.2 milestone Oct 19, 2017
@david-rhodes
Copy link

@mihakrajnc closing for now. Please let us know if you find a specific feature that breaks Earcut!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants