Skip to content

Commit

Permalink
Fixed crashes when an object of unknown asteroid provider exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorwin99 committed Sep 12, 2021
1 parent db5f889 commit f5403ff
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ public override void UpdateGpsForPlayer(MyEntityTracker entity)

MySystemAsteroids asteroid = obj as MySystemAsteroids;
Vector3D entityPosition = player.PositionComp.GetPosition();
var provider = MyAsteroidObjectsManager.Static.AsteroidObjectProviders[asteroid.AsteroidTypeName];

if (!MyAsteroidObjectsManager.Static.AsteroidObjectProviders.TryGetValue(asteroid.AsteroidTypeName, out var provider)) continue;

IMyAsteroidObjectShape shape = provider.GetAsteroidObjectShape(asteroid);

Expand Down Expand Up @@ -350,7 +351,7 @@ private MySystemAsteroids GetAsteroidObjectAt(Vector3D position)
if (obj.Type != MySystemObjectType.ASTEROIDS) continue;
var asteroids = obj as MySystemAsteroids;

var prov = MyAsteroidObjectsManager.Static.AsteroidObjectProviders[asteroids.AsteroidTypeName];
if (!MyAsteroidObjectsManager.Static.AsteroidObjectProviders.TryGetValue(asteroids.AsteroidTypeName, out var prov)) continue;

IMyAsteroidObjectShape shape = prov.GetAsteroidObjectShape(asteroids);

Expand Down

0 comments on commit f5403ff

Please sign in to comment.