Fix null variable bug

This commit is contained in:
zontreck 2024-08-01 18:23:07 -07:00
parent 17262bdaf0
commit c617d999c8

View file

@ -339,11 +339,11 @@ string getPage(string sMenu, integer iPage, integer iCheckUUID) {
lPageButtons = getNavigatorButtons(iPage, totalPages) + lPageButtons;
// Loop over the buttons, check if UUID, replace with a number instead if UUID
string sExtraText = " ";
if(!iCheckUUID) jump returnMenu;
i =0;
integer end = llGetListLength(lPageButtons);
integer idNum = 0;
string sExtraText = " ";
for(i=0;i<end;i++) {
string sButton = llList2String(lPageButtons, i);
if(IsLikelyAvatarID(sButton)) {
@ -411,13 +411,13 @@ default
integer iPage = getPageNumber(i);
DEBUG("Get current page number for menu " + sMenuID + ": " + (string)iPage);
string sMenu = "";
string jsMenu = "";
if(sMenuID != "") sMenu = readMenu(sMenuID);
DEBUG("Menu Json: " + sMenu);
if(sMenuID != "") jsMenu = readMenu(sMenuID);
DEBUG("Menu Json: " + jsMenu);
integer iMaxPages = 0;
if(sMenuID != "") iMaxPages = calcMaxPages(sMenu);
if(sMenuID != "") iMaxPages = calcMaxPages(jsMenu);
DEBUG("Get max number of pages: " + (string)iMaxPages);
if(m == PREVIOUS_MENU) {
@ -429,7 +429,7 @@ default
if(iPage < 0) iPage=0;
string sPage = getPage(sMenu, iPage, TRUE);
string sPage = getPage(jsMenu, iPage, TRUE);
list lPageButtons = llParseString2List(llJsonGetValue(sPage, ["buttons"]), ["~!~"], []);
@ -437,7 +437,7 @@ default
string sAppend = llJsonGetValue(sPage, ["text"]);
if(iMaxPages > 1) sAppend += "\n\nPage " + (string)iPage + "/" + (string)(iMaxPages-1);
llDialog(i, llJsonGetValue(sMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
llDialog(i, llJsonGetValue(jsMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
DEBUG_STMT(FALSE, "Previous Menu");
} else if(m == NEXT_MENU) {
DEBUG_STMT(TRUE, "Next Menu");
@ -448,7 +448,7 @@ default
if(iPage < iMaxPages-1) iPage=iMaxPages-1;
string sPage = getPage(sMenu, iPage, TRUE);
string sPage = getPage(jsMenu, iPage, TRUE);
list lPageButtons = llParseString2List(llJsonGetValue(sPage, ["buttons"]), ["~!~"], []);
@ -456,14 +456,14 @@ default
string sAppend = llJsonGetValue(sPage, ["text"]);
if(iMaxPages > 1) sAppend += "\n\nPage " + (string)iPage + "/" + (string)(iMaxPages-1);
llDialog(i, llJsonGetValue(sMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
llDialog(i, llJsonGetValue(jsMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
DEBUG_STMT(FALSE, "Next Menu");
} else if(m == " ") {
DEBUG_STMT(TRUE, "Empty Button");
// Update the time remaining
updateTimer(i, MENU_TIMER);
string sPage = getPage(sMenu, iPage, TRUE);
string sPage = getPage(jsMenu, iPage, TRUE);
list lPageButtons = llParseString2List(llJsonGetValue(sPage, ["buttons"]), ["~!~"], []);
@ -471,7 +471,7 @@ default
string sAppend = llJsonGetValue(sPage, ["text"]);
if(iMaxPages > 1) sAppend += "\n\nPage " + (string)iPage + "/" + (string)(iMaxPages-1);
llDialog(i, llJsonGetValue(sMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
llDialog(i, llJsonGetValue(jsMenu, ["prompt"]) + sAppend, lPageButtons, getChannel(i));
DEBUG_STMT(FALSE, "Empty Button");
} else if(m == EXIT_MENU) {
DEBUG_STMT(TRUE, "Exit Menu");
@ -481,7 +481,7 @@ default
DEBUG_STMT(TRUE, "Process Response");
// Stop listening, and send a signal
string sPage = "";
if(sMenu != "") sPage = getPage(sMenu, iPage, FALSE);
if(jsMenu != "") sPage = getPage(jsMenu, iPage, FALSE);
DEBUG("Parse Buttons");
// Check Message, if message is found in list, it isn't UUID.