Fix invalid file paths causing unexpected behavior

This commit is contained in:
in1tiate 2024-05-26 15:31:15 -05:00
parent 67d5646d7c
commit 0475b2a045

View File

@ -25,6 +25,17 @@ void AnimationLoader::load(const QString &fileName)
{ {
return; return;
} }
else if (fileName == QObject::tr("Invalid File"))
{
// Set the image to a null pixmap if it's invalid
stopLoading();
m_size = QSize(1, 1);
m_frames.clear();
m_frames.append(AnimationFrame(QPixmap(), 0));
m_frame_count = 1;
m_loop_count = 0;
return;
}
stopLoading(); stopLoading();
m_file_name = fileName; m_file_name = fileName;
QImageReader *reader = new QImageReader; QImageReader *reader = new QImageReader;