- pictureviewer: do only show picture if decoding succeed

based upon patch "fix screensaver" by max10 <max_10@gmx.de>
This commit is contained in:
svenhoefer
2015-03-19 10:54:45 +01:00
parent 3299911086
commit ff1a7b8640

View File

@@ -166,6 +166,7 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign,
if (fh) { if (fh) {
if (m_NextPic_Buffer != NULL) { if (m_NextPic_Buffer != NULL) {
free (m_NextPic_Buffer); free (m_NextPic_Buffer);
m_NextPic_Buffer = NULL;
} }
m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3); m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3);
if (m_NextPic_Buffer == NULL) { if (m_NextPic_Buffer == NULL) {
@@ -225,6 +226,7 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign,
printf ("Unable to read file or format not recognized!\n"); printf ("Unable to read file or format not recognized!\n");
if (m_NextPic_Buffer != NULL) { if (m_NextPic_Buffer != NULL) {
free (m_NextPic_Buffer); free (m_NextPic_Buffer);
m_NextPic_Buffer = NULL;
} }
m_NextPic_Buffer = (unsigned char *) malloc (3); m_NextPic_Buffer = (unsigned char *) malloc (3);
if (m_NextPic_Buffer == NULL) { if (m_NextPic_Buffer == NULL) {
@@ -264,8 +266,8 @@ bool CPictureViewer::ShowImage (const std::string & filename, bool unscaled)
free (m_CurrentPic_Buffer); free (m_CurrentPic_Buffer);
m_CurrentPic_Buffer = NULL; m_CurrentPic_Buffer = NULL;
} }
DecodeImage (filename, true, unscaled); if (DecodeImage (filename, true, unscaled))
DisplayNextImage (); DisplayNextImage ();
// dbout("Show Image }\n"); // dbout("Show Image }\n");
return true; return true;
} }