Jump to content

Stack overflow


Drakath

Recommended Posts

I'm getting stack overflow error. It happened when I made this function:

function savePass() 
local xmlFile = xmlLoadFile(xmlFileName) 
        if guiCheckBoxGetSelected(PasswordSave) then 
            xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) 
            xmlSaveFile(xmlFile) 
            xmlUnloadFile(xmlFile) 
        elseif not guiCheckBoxGetSelected(PasswordSave) then 
            xmlNodeSetAttribute(xmlFile,"password","") 
            xmlSaveFile(xmlFile) 
            xmlUnloadFile(xmlFile)       
end 
end 
addEventHandler("onClientGUIClick",btnLogin,savePass) 

It says that the error is on line 285 which is: xmlSaveFile(xmlFile)

function xmlFileHandler(gReturn) 
    local xmlFile = xmlLoadFile(xmlFileName) 
    if not xmlFile then 
        xmlFile = xmlCreateFile(xmlFileName,"settings")  
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
    if (gReturn) then 
        if (gReturn == true) then 
            loginPanel() 
        else 
            return 
        end 
    end 
end 
  

Link to comment

How can this help?

The error appeared when I made savePass function and I also noticed that it works if I change this:

function savePass() 
local xmlFile = xmlLoadFile(xmlFileName) 
        if guiCheckBoxGetSelected(PasswordSave) then 
            xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) 
            xmlSaveFile(xmlFile) 
            xmlUnloadFile(xmlFile) 
        elseif not guiCheckBoxGetSelected(PasswordSave) then 
            xmlNodeSetAttribute(xmlFile,"password","") 
            xmlSaveFile(xmlFile) 
            xmlUnloadFile(xmlFile)       
end 
end 

into this:

function savePass() 
local xmlFile = xmlLoadFile(xmlFileName) 
        if guiCheckBoxGetSelected(PasswordSave) then 
            xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) 
            xmlSaveFile(xmlFile) 
            xmlUnloadFile(xmlFile)   
end 
end 

However the password will always be saved if I do this. I need it to set the password to "" when checkbox is unchecked.

Link to comment
function savePass ( ) 
    local xmlFile = xmlLoadFile ( xmlFileName ) 
    local pass = ( guiCheckBoxGetSelected ( PasswordSave ) and tostring ( guiGetText ( editPassword ) ) or "" ) 
    xmlNodeSetAttribute ( xmlFile, "password", pass ) 
    xmlSaveFile ( xmlFile ) 
    xmlUnloadFile ( xmlFile ) 
end 

Try that one.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...