LiveSplit / SpeedrunComSharp

A .NET Library that can be used to interact with the Speedrun.com API
MIT License
32 stars 9 forks source link

Added more null checks to ImageAsset.Parse #17

Closed ShikenNuggets closed 4 years ago

ShikenNuggets commented 4 years ago

Added extra checks to confirm that the uri, width, and height parameters are available before using them, as this function will currently throw a RuntimeBinder exception in the event of a broken icon (for example: Fossil Fighters has a broken icon as of writing, so no width or height value is received from the API).

Fixes Issue https://github.com/LiveSplit/SpeedrunComSharp/issues/19

CryZe commented 4 years ago

This should be considered a bug on speedrun.com's side. I don't think this should've been merged :(

CryZe commented 4 years ago

However I guess it's still better to be more conservative on our side, so I guess this is fine, as long as the bug is properly reported to them.

ShikenNuggets commented 4 years ago

For sure, SR.C definitely shouldn't be giving us bad data, but since it does more often than I'd like I figure it's better to not have the parse explode in the event of a server-side issue like this.