I've tried everything and still can't find whats wrong with this piece of code:
it's throwing
Line 163 being " if (tar.Value.UnitExists && "
SpellTracker.Targets is dictionary, all variables have assigned values inside constructor, tried also assigning them in declaration and some other things, can't seem to find the right one.
Any ideas?
PHP:
private WoWUnit GetClosestValidCastingTarget
{
get
{
WoWUnit unit = null;
foreach (KeyValuePair<string,UnitSpellcastingInfo> tar in SpellTracker.Targets)
{
if (tar.Value.UnitExists &&
(unit.Distance < tar.Value.Unit.Distance || unit == null) &&
tar.Value.Included && //tar.Value.IsUnitEnemy &&
((tar.Value.IsCasting && tar.Value.msCastTimeLeft < Settings.CastMillisecondsLeft) ||
(tar.Value.IsChannelling && tar.Value.msCastTimeElapsed > Settings.ChannelMillisecondsElapsed)) &&
tar.Value.Interruptible &&
InterrupterContainer.Spells.ContainsKey(tar.Value.SpellID) &&
InterrupterContainer.Spells[tar.Value.SpellID].Include &&
InterrupterContainer.Spells[tar.Value.SpellID].TagGroupIDs.Any(tag =>
InterrupterContainer.Tags.ContainsKey(tag) && InterrupterContainer.Tags[tag].Include) &&
!InterrupterContainer.Spells[tar.Value.SpellID].TagGroupIDs.Any(tag =>
InterrupterContainer.Tags.ContainsKey(tag) && InterrupterContainer.Tags[tag].EntirelyExclude)
)
unit = tar.Value.Unit;
}
return unit;
}
}
it's throwing
Code:
[1:08:29 AM:879] System.NullReferenceException: Object reference not set to an instance of an object.
at InterrupterUltimate.InterrupterUltimate.get_GetClosestValidCastingTarget() in e:\A\Honorbuddy\Plugins\Interrupter Ultimate\InterrupterUltimate.Helpers.cs:line 163
at InterrupterUltimate.InterrupterUltimate.ChooseSpell() in e:\A\Honorbuddy\Plugins\Interrupter Ultimate\InterrupterUltimate.Spells.cs:line 12
at InterrupterUltimate.InterrupterUltimate.Pulse() in e:\A\Honorbuddy\Plugins\Interrupter Ultimate\InterrupterUltimate.cs:line 56
at Styx.Plugins.PluginWrapper.Pulse()
SpellTracker.Targets is dictionary, all variables have assigned values inside constructor, tried also assigning them in declaration and some other things, can't seem to find the right one.
Any ideas?
Last edited: