don't crash on empty orders
This commit is contained in:
@@ -138,7 +138,8 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
void ApplyOrders(World world, int2 xy, MouseInput mi)
|
void ApplyOrders(World world, int2 xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (world.OrderGenerator == null) return;
|
if (world.OrderGenerator == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var pos = worldRenderer.Position(xy);
|
var pos = worldRenderer.Position(xy);
|
||||||
var orders = world.OrderGenerator.Order(world, pos.ToCPos(), mi).ToArray();
|
var orders = world.OrderGenerator.Order(world, pos.ToCPos(), mi).ToArray();
|
||||||
@@ -149,6 +150,9 @@ namespace OpenRA.Widgets
|
|||||||
foreach (var order in orders)
|
foreach (var order in orders)
|
||||||
{
|
{
|
||||||
var o = order;
|
var o = order;
|
||||||
|
if (o == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!flashed)
|
if (!flashed)
|
||||||
{
|
{
|
||||||
if (o.TargetActor != null)
|
if (o.TargetActor != null)
|
||||||
|
|||||||
@@ -158,7 +158,12 @@ namespace OpenRA
|
|||||||
// Find an actor with a phrase to say
|
// Find an actor with a phrase to say
|
||||||
foreach (var o in orders)
|
foreach (var o in orders)
|
||||||
{
|
{
|
||||||
if (o.Subject.Destroyed) continue;
|
if (o == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (o.Subject.Destroyed)
|
||||||
|
continue;
|
||||||
|
|
||||||
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
|
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
|
||||||
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o),
|
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o),
|
||||||
o.Subject, o.Subject.Owner.Country.Race))
|
o.Subject, o.Subject.Owner.Country.Race))
|
||||||
|
|||||||
Reference in New Issue
Block a user