pictureviewer: do only show picture if decoding succeed

based upon patch "fix screensaver" by max10 <max_10@gmx.de>


Origin commit data
------------------
Commit: ff1a7b8640
Author: vanhofen <vanhofen@gmx.de>
Date: 2015-03-19 (Thu, 19 Mar 2015)

Origin message was:
------------------
- pictureviewer: do only show picture if decoding succeed

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

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,7 +266,7 @@ 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;