Drakath Posted December 24, 2013 Share Posted December 24, 2013 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
Castillo Posted December 24, 2013 Share Posted December 24, 2013 On which function is the stack overflow appearing? Link to comment
Drakath Posted December 24, 2013 Author Share Posted December 24, 2013 xmlFileHandler but it happened when I made savePass Link to comment
Castillo Posted December 24, 2013 Share Posted December 24, 2013 When are you executing: "xmlFileHandler"? Link to comment
Drakath Posted December 24, 2013 Author Share Posted December 24, 2013 When they join to check if they have a settings.xml file and when they click the login button. Link to comment
Castillo Posted December 24, 2013 Share Posted December 24, 2013 Can you post the parts where it executes it? Link to comment
Drakath Posted December 24, 2013 Author Share Posted December 24, 2013 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
Castillo Posted December 24, 2013 Share Posted December 24, 2013 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now