Hi,

I am having this problem when i try to execute the .exe of my application
"Debug assertion failed !, Expression invalid null pointer"

After a bit of googling i think so i know where the problem lies, but have no idea how to solve it.

Below is the relevant piece of code.

size_t idx;
    // create the initial texture
    atlases.push_back(new TextureAtlas( image_names.size()));
    //  load the texture
    for (idx = 0; idx < image_names.size(); ++idx) {

        //load the image
        TextureInformation *ti = new TextureInformation (idx, folder_location_str, image_names[idx]);

During the execution of the code at the line where ti is initialized and declared the values at local tab(in ms visual c++ 2008) are something like below.

ti  TextureInformation *
        idx CXX0030: Error: expression cannot be evaluated  
        image_path  {npos=4294967295 _Bx={...} _Mysize=??? ...} std::basic_string<char,std::char_traits<char>,std::allocator<char> >
        image_name  {npos=4294967295 _Bx={...} _Mysize=??? ...} std::basic_string<char,std::char_traits<char>,std::allocator<char> >
        image   CXX0017: Error: symbol "" not found 

For some reason: idx and image shows error here and this only happens during the first iteration of the for loop. Below is the content of ti during the second iteration

        idx 0   unsigned int
+       image_path  ".....Related\PNG\" std::basic_string<char,std::char_traits<char>,std::allocator<char> >
+       image_name  "basn0g01.png"  std::basic_string<char,std::char_traits<char>,std::allocator<char> >
+       image   0x00812830 {m_info={...} m_pixbuf={...} }   png::image<png::basic_rgba_pixel<unsigned char> > *

This is how my TextualInformation looks

class TextureInformation
{
public:
    TextureInformation(size_t index, std::string path, std::string name)
    : idx(index), image_path(path), image_name(name)
    {
        image = new png::image<png::rgba_pixel>(image_path + image_name,
                png::convert_color_space<png::rgba_pixel>());
    }
~TextureInformation(void)
    {
        delete image;
    }
....
....
private:
    size_t                           idx;
    std::string                   image_path;
    std::string                   image_name;
    png::image<png::rgba_pixel>*  image;
};

Please tell me if other details are required. Thanks

Member Avatar for iamthwee

You were instructed by Ancient Dragon in a previous thread to use CodeBlocks because the compiler that it is using has a better chance of working/easier to get working than the one Visual studio uses.

So post back here when you've downloaded CodeBlocks.

I have downloaded codeblocks. But for this project i have to also configure libpng and png++ and that already took a lot of time with VC++ so i do not want to do the same for the code blocks now. Maybe from the next time i will get started with Codeblocks and that would be a lot easier. Thanks

It looks like there exist a null pointer some where. Is line 8 TextureInformation *ti = new TextureInformation (idx, folder_location_str, image_names[idx]); correct ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.