Run time error 7: "Stack underflow"
#1

Okay, I'm getting this error that is preventing my gamemode from fully starting.

Run time error 7: "Stack underflow"

I don't know what it is, or what I did to get this error, so I debugged the gamemode and it seems to crash after my...
LoadServer();
... function.

Here's the code to that, please help me.

pawn Code:
stock LoadServer()
{
    new
        Query[128],
        Data;
    format(Query, 128, "SELECT * FROM serverdata WHERE Enabled = 1");
    mysql_query(Query);
    mysql_store_result();
    Data = mysql_num_rows();
    mysql_free_result();
   
    if(Data >= 1)
    {
        mysql_query(Query);
        mysql_store_result();
        while(mysql_fetch_row_format(Query, "|"))
        {
            new
                Enabled[128],
                Value[128];
               
            mysql_fetch_field_row(Enabled, "Enabled");
/*          #pragma unused Enabled
Calgon suggested removing this but it did not fix the error. */

               
            mysql_fetch_field_row(Server[sName], "Name");
           
            mysql_fetch_field_row(Server[sVersion], "Version");
           
            mysql_fetch_field_row(Server[sMap], "Map");
           
            mysql_fetch_field_row(Server[sWebsite], "Website");
           
            mysql_fetch_field_row(Server[sTime], "Time");
           
            mysql_fetch_field_row(Value, "Hour");
            Server[sHour] = strval(Value);
           
            mysql_fetch_field_row(Value, "Minute");
            Server[sMinute] = strval(Value);
           
            mysql_fetch_field_row(Value, "Second");
            Server[sSecond] = strval(Value);
           
            mysql_fetch_field_row(Server[sDate], "Date");
           
            mysql_fetch_field_row(Value, "Year");
            Server[sYear] = strval(Value);
           
            mysql_fetch_field_row(Value, "Month");
            Server[sMonth] = strval(Value);
           
            mysql_fetch_field_row(Server[sMonthName], "MonthName");
           
            mysql_fetch_field_row(Value, "Day");
            Server[sDay] = strval(Value);
           
            mysql_fetch_field_row(Value, "Weather");
            Server[sWeather] = strval(Value);
           
            mysql_fetch_field_row(Server[sOwner], "Owner");
           
            mysql_fetch_field_row(Server[sCoOwner], "CoOwner");
           
            mysql_fetch_field_row(Server[sScripter], "Scripter");
           
            mysql_fetch_field_row(Server[sMapper], "Mapper");
        }
        mysql_free_result();
    }
    return 1;
}
I am using BlueG's version of MySQL.

Update:
Debug.txt :
Code:
[21:30:08] >> mysql_query( Connection handle: 1 )

[21:30:08] CMySQLHandler::Query(SELECT * FROM serverdata WHERE Enabled = 1) - Successfully executed.

[21:30:08] >> mysql_store_result( Connection handle: 1 )

[21:30:08] CMySQLHandler::StoreResult() - Result was stored.

[21:30:08] >> mysql_fetch_row_format( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchRow() - Return: 1|TheLazySloth's Server|0.3c R5|Red County|forum.sa-mp.com|20:03:34|20|3|34|11/20/2011|2011|11|November|20|2|TheLazySloth|Unknown|TheLazySloth|TheLazySloth

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Enabled") - 1

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Name") - TheLazySloth's Server

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Version") - 0.3c R5

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Map") - Red County

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Website") - forum.sa-mp.com

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Time") - 20:03:34

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Hour") - 20

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Minute") - 3

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Second") - 34

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Date") - 11/20/2011

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Year") - 2011

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Month") - 11

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("MonthName") - November

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Day") - 20

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Weather") - 2

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Owner") - TheLazySloth

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("CoOwner") - Unknown

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Scripter") - TheLazySloth

[21:30:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:30:08] CMySQLHandler::FetchField("Mapper") - TheLazySloth

[21:30:08] >> mysql_fetch_row_format( Connection handle: 1 )

[21:30:08] >> mysql_free_result( Connection handle: 1 )

[21:30:08] CMySQLHandler::FreeResult() - Result was successfully free'd.
Update #2: I made LoadServer() return print("Debug."); and when I turn the server on again, still gives me the error but it displays Debug. on the server console... What is up?

Update #3: I don't get the error anymore, but I get the same problem, the server fails to load fully and when I debug it stops at the Loadserver(); function.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)