NullReferenceException when trying to set class property

后端 未结 7 1697
醉酒成梦
醉酒成梦 2021-01-22 00:56

Basically I have 2 classes, \"Manifest\" and \"BrowserAction\", set out like this:

public class BrowserAction
{
    public string default_icon {get; set;}
    pu         


        
7条回答
  •  逝去的感伤
    2021-01-22 01:34

    You've initialised newManifest, but browser_action is still null (presumably).

    You are then trying to set default_popup on the null browser_action and getting the exception

    newManifest.browser_action.default_popup = "popup.html";

提交回复
热议问题