Lister Vars is null

If I use var Lister = activateTabData.oldtab.lister; I get the error "Vars is null" when closing a tab.

// Called by Directory Opus to initialize the script
function OnInit(initData)
{ = "Test";
	initData.version = "1.0";
	initData.copyright = "(c) 2023 Ken";
//	initData.url = "";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "13.0";


// Called when a new Lister is opened
function OnOpenLister(openListerData)
    if (!openListerData.after)
	    return true
    DOpus.Output("The tabs of the lister have been opened")
	openListerData.Lister.Vars.Set("exec", 0);

// Called when a tab is activated
function OnActivateTab(activateTabData)
    var Lister = activateTabData.oldtab.lister;
	if (!Lister.Vars.Exists("exec")) return;
	DOpus.Output("Activate tab")

If I use var Lister = activateTabData.newtab.lister; it works fine.

It's because the OnActivateTab event is run asynchronously and the old tab is in the process of being destroyed.

In the next beta we'll change it so that OnActivateTab runs synchronously if the activation change is due to a tab being closed.

I changed the object and still get the error sometimes, especially if I close tabs continuously.

	//var Lister = tab.Lister;
	var Lister = DOpus.Listers(0);