Jump to content

Stack overflow


Drakath

Recommended Posts

Posted

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 
  

s.epicrow.com:22003.png

Posted

On which function is the stack overflow appearing?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

When are you executing: "xmlFileHandler"?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Can you post the parts where it executes it?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

s.epicrow.com:22003.png

Posted
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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...