ScriptForge (SF_Base) tdf#156599 Error message when loading a form

Error occurs in SF_Base.IsLoaded(...)
"Object variable not set"

When user scripts run the method repeatedly from
nearly simultaneous events, it might happen
that the _FormDocuments private variable is
not initialized.

Simultaneous calls may be interpreted as internal
calls. Internal calls do not execute the "Check"
part of the published API.
Hence the failing initialization.

Solution: force the initialization of that specific
variable at each run.

Change-Id: I489cbaed7b8e57d6876b7af4b26f5be0beb3db69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157374
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba
index f96ddfd..b6497b9 100644
--- a/wizards/source/sfdocuments/SF_Base.xba
+++ b/wizards/source/sfdocuments/SF_Base.xba
@@ -415,10 +415,10 @@ Const cstSubArgs = &quot;FormDocument&quot;
	bLoaded = False

Check:
	If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments()
	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not _IsStillAlive() Then GoTo Finally
		&apos;	Build list of available FormDocuments recursively with _CollectFormDocuments
		If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments()
		vFormNames = Split(_CollectFormDocuments(_FormDocuments), cstToken)
		If Not ScriptForge.SF_Utils._Validate(FormDocument, &quot;FormDocument&quot;, V_STRING, vFormNames) Then GoTo Finally
	End If