在listview想增加某些数据时发生了错误
if(weaponlist.SelectedItem is Weapon weapon)
{
weaponattribute.Items.Add(weapon.WeaponName);
weaponattribute.Items[weapon.WeaponName].SubItems.Add(weapon.Softattack.ToString());
weaponsoftattack.Text = weapon.Softattack.ToString();
}
但是下面的text能够正常引用该对象,实在不清楚是什么错误
错误不是很明显了吗,空指针了。weapon 这个debug看下有没有值!