Błąd poczas rzutowania
Point p = new Point();
p = (Point)(sender as Button).Tag;
wyświetla błąd
An unhandled exception of type 'System.NullReferenceException' occurred in .exe
Podaje poniższą pentle
private void button1_Click(object sender, EventArgs e)
{
if (!Ready)
{
MessageBox.Show("Podaj imiona graczy!");
return;
}
Point p = new Point();
p = (Point)(sender as Button).Tag;
(sender as Button).Text = GomokuObj.Active.Type == FieldType.ftCircle ? "O" : "X";
GomokuObj.Set(p.X, p.Y);
if (GomokuObj.Winner)
{
MessageBox.Show(String.Format("Brawo dla {0}", GomokuObj.Active.Name), "Wygrana!");
}
}
Jak rozwiązać żeby nie wystąpiła wartość null