无效的最后花括号上的NullReferenceException

时间:2018-06-24 09:27:06

标签: c# nullreferenceexception

    protected void UserControl_ButtonClick(object sender, EventArgs e) {
        var uri = string.Format("https://api.ethplorer.io/getTokenInfo/{0}?apiKey=apikey", addTokenPop.getAddress());
        if (GetResponseText(uri) == "") {
            MessageBox.Show("Incorrect Address / Network Error");
            addTokenPop.resetBox();
            addTokenPop.Hide();
        } else {
          Properties.WalletData.Default.tokens.Add(addTokenPop.getAddress());
          Properties.WalletData.Default.Save();
          addTokenPop.resetBox();
          addTokenPop.Hide();
        }

    }

程序通过if语句,跳转到else语句,在执行Properties.WalletData.Default.tokens.Add(addTokenPop.getAddress());之前,它具有NullReferenceException。 NullReferenceException显示在void的最后花括号中

0 个答案:

没有答案