Assertion failed?

Hey everybody, i honestly have no idea what the problem could be with this one
I keep getting sigabrt. I can draw bitmaps fine but sometimes it just crashes. It just tells me
Assertion failed: (bitmap->parent == ((void *)0)), function _bitmap_drawer, file /Users/angeljbatez5/allegro/src/bitmap.c, line 208.

My drawing methods are:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if(redraw && al_event_queue_is_empty(event_queue))
{ //Drawing methods
    redraw = false;
    for (int x=0; x<7; ++x)
    {
        for (int y=0; y<5; ++y)
        {
            if (tile[x][y].type == 0)
            {
                 al_draw_bitmap(empty, tile[x][y].x*64,  tile[x][y].y*64, 0); //<- Crashes here with signal SIGABRT
            }
            else if (tile[x][y].type == 1)
            {
                 al_draw_bitmap(wall,  tile[x][y].x*64,  tile[x][y].y*64, 0);
            }
            else if (tile[x][y].type == 2)
            {
                 al_draw_bitmap(end,  tile[x][y].x*64,  tile[x][y].y*64, 0);
            }
            else if (tile[x][y].type == 3)
            {
                 al_draw_bitmap(current,  tile[x][y].x*64,  tile[x][y].y*64, 0);
            }
        }
    } 
    al_flip_display();
}

Im using Allegro 5 with xcode
Thanks in advance :)
Last edited on
Check function arguments before calling al_draw_bitmap(...), most likely you have a NULL pointer, like the error message says.
The arguments to al_draw_bitmap? The problem happens after ive draw a couple of bitmaps already
Really need help with this guys.
The problem happens after ive already drawn the bitmap a few times so its not because its null
Do you use a debugger?
Also, your bracketing seams to be inconsistent.
There i tried to space it as best as i could, im on my phone right now, but my bracketing looks fine to me
And yes, i use xcodes debugger
Last edited on
Ok so at what iteration does it explode? What is [x][y] and empty at the point of segfault?
Topic archived. No new replies allowed.