Inno Setup program Im getting a run error using 6.2.2 Access Violation

47 Views Asked by At

In this code I'm getting Run time error Exception Access Violation at address 00901E9C Execution of address 00901E9C when it hit objNodes.item(0).setAttribute(xAttrib, xAttribSetValue); Any help will be grateful.

 function ConfigXMLSettingsXAttrib(xpath, xmlFile, xAttrib, xAttribSetValue: String): Boolean;
    var
      XMLDoc, objNodes: Variant;
    begin
      Result := False;

    XMLDoc := GetXMLDocInstance(xmlFile);

    if not VarIsEmpty(XMLDoc) and not VarIsNull(XMLDoc) then
    begin
      objNodes := XMLDoc.selectNodes(xpath);
      try
      if not VarIsEmpty(objNodes) and (objNodes.Length > 0) then
      begin
        if not VarIsNull(objNodes.item(0)) then
        begin
          objNodes.item(0).setAttribute(xAttrib, xAttribSetValue);
          Result := True;
        end
       
      end
      except
       Log(''Unable to set xpathsetvalue)
    end;

    XMLDoc.Save(xmlFile);
  end;
end;
0

There are 0 best solutions below