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

TextureConverter.DetectVertices() throws InvalidOperationException on blank textures #52

Open
harrisse opened this issue Feb 10, 2018 · 1 comment

Comments

@harrisse
Copy link

harrisse commented Feb 10, 2018

In TextureConverter:274 there's a possible InvalidOperationException when accessing polygonEntrance.Value. This will only occur when GetTopMostVertex returns null which will only occur when the texture is blank. As an example of where this might occur in the wild is with programmatically generated textures, or in my case, a texture atlas with the occasional blank tile.

My vote for a resolution is for the method to either return null, or return new List<Vertices>() or throw new Exception("Your texture is blank.") (or some message like that).

EDIT: After further testing, it looks like this method may also throw when there are one pixel wide polygons. I can reproduce consistently with some textures but not with others containing 1 pixel polygons. Will update when I figure out the pattern.

@harrisse
Copy link
Author

This user appears to have encountered the same issue: http://community.monogame.net/t/farseer-physics-texture-to-body-problem/6942

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

No branches or pull requests

1 participant