mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
gobj: Fix crash when trying to load directory as txo/dds/ktx file
This commit is contained in:
parent
38488d89a2
commit
340dea5261
@ -3575,6 +3575,12 @@ do_read_txo_file(CData *cdata, const Filename &fullpath) {
|
||||
}
|
||||
|
||||
istream *in = file->open_read_file(true);
|
||||
if (in == nullptr) {
|
||||
gobj_cat.error()
|
||||
<< "Failed to open " << filename << " for reading.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = do_read_txo(cdata, *in, fullpath);
|
||||
vfs->close_read_file(in);
|
||||
|
||||
@ -3630,6 +3636,12 @@ do_read_dds_file(CData *cdata, const Filename &fullpath, bool header_only) {
|
||||
}
|
||||
|
||||
istream *in = file->open_read_file(true);
|
||||
if (in == nullptr) {
|
||||
gobj_cat.error()
|
||||
<< "Failed to open " << filename << " for reading.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = do_read_dds(cdata, *in, fullpath, header_only);
|
||||
vfs->close_read_file(in);
|
||||
|
||||
@ -4310,6 +4322,12 @@ do_read_ktx_file(CData *cdata, const Filename &fullpath, bool header_only) {
|
||||
}
|
||||
|
||||
istream *in = file->open_read_file(true);
|
||||
if (in == nullptr) {
|
||||
gobj_cat.error()
|
||||
<< "Failed to open " << filename << " for reading.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = do_read_ktx(cdata, *in, fullpath, header_only);
|
||||
vfs->close_read_file(in);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user