Run time error: Invalid Memory Access
#1

The code:
pawn Код:
stock GetBusinessFurnitureCount(bizindex)
{
    new count = 0;
    for(new i = 0; i < MAX_BUSINESS_FURNITURE; i++)
    {
        if(i < 0 || i >= MAX_BUSINESS_FURNITURE || bizindex < 0 || bizindex >= MAX_BIZNES)
            printf("GetBusinessFurnitureCount(%d) is invalid index. i:%d", bizindex, i);
        if(BusinessFurniture[ bizindex ][ i ][ SqlId ])
            count++;
    }
    return count;
}
The backtrace.
pawn Код:
[19:25:40] [debug] Run time error 5: "Invalid memory access"
[19:25:40] [debug] AMX backtrace:
[19:25:40] [debug] #0 00064e64 in GetBusinessFurnitureCount (bizindex=29) at Property\Businesses.p:1306
The problematic line:
pawn Код:
if(BusinessFurniture[ bizindex ][ i ][ SqlId ])
Declaration of array and its enum:
pawn Код:
enum E_BUSINESS_FURNITURE_DATA {
    SqlId,
    FurnitureId,
    ObjectId,
    Name[ MAX_FURNITURE_NAME]
};
new BusinessFurniture[ MAX_BIZNES ][ MAX_BUSINESS_FURNITURE ][ E_BUSINESS_FURNITURE_DATA ];
Also I was unable to get the same result on my local server. For some reasons it only appears in my VPS. I think it might be due to the number of players although I dont yet see how can that be the case.

By googling I already added checks for invalid indexes, they do not appear. What else could cause this? I'm quite desperete, so ANY ideas at all will be appreciated.
Reply
#2

bump
Reply
#3

Any chance you use GetPVarString() any near that?
Reply
#4

Sadly no.

I use it like so:
pawn Код:
else if(IsPlayerInAnyBusiness(playerid))
    {
        index = GetPlayerBusinessIndex(playerid);
        furnitureCount = GetBusinessFurnitureCount(index);
Reply
#5

mighty bump.
Reply
#6

It's still an issue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)