0

当我尝试执行我的应用程序“调试断言失败!,表达式无效空指针”的 .exe 时遇到此问题

经过一番谷歌搜索后,我想我知道问题出在哪里,但不知道如何解决它。

下面是相关的代码。

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]);

在初始化 ti 并声明本地选项卡(在 ms visual c++ 2008 中)处的值的行的代码执行期间,如下所示。

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 

出于某种原因: idx 和 image 在这里显示错误,这仅在 for 循环的第一次迭代期间发生。下面是第二次迭代时ti的内容

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> > *

这就是我的 TextualInformation 的样子

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;
};

请告诉我是否需要其他详细信息。谢谢

4

0 回答 0