item should be checked before dereferencing

From: Erik Hovland <erik@hovland.org>


---

 .../mythgallery/mythgallery/glsingleview.cpp       |    2 +-
 mythplugins/mythgallery/mythgallery/iconview.cpp   |    9 ++-------
 mythplugins/mythgallery/mythgallery/singleview.cpp |    2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/mythplugins/mythgallery/mythgallery/glsingleview.cpp b/mythplugins/mythgallery/mythgallery/glsingleview.cpp
index 1483b2a..61f1b80 100644
--- a/mythplugins/mythgallery/mythgallery/glsingleview.cpp
+++ b/mythplugins/mythgallery/mythgallery/glsingleview.cpp
@@ -209,7 +209,7 @@ void GLSingleView::paintGL(void)
                 cmd = "Internal";
                 gContext->GetMainWindow()->HandleMedia(cmd, item->GetPath());
             }
-            else
+            else if (item)
             {
                 QString path = QString("\"%1\"").arg(item->GetPath());
 
diff --git a/mythplugins/mythgallery/mythgallery/iconview.cpp b/mythplugins/mythgallery/mythgallery/iconview.cpp
index c1d9ba9..f26dbb4 100644
--- a/mythplugins/mythgallery/mythgallery/iconview.cpp
+++ b/mythplugins/mythgallery/mythgallery/iconview.cpp
@@ -57,7 +57,8 @@ using namespace std;
 class FileCopyThread: public QThread
 {
   public:
-    FileCopyThread(IconView *parent, bool move);
+    FileCopyThread(IconView *parent, bool move)
+        : m_move(move), m_parent(parent), m_progress(0) {}
     virtual void run();
     int GetProgress(void) { return m_progress; }
 
@@ -67,12 +68,6 @@ class FileCopyThread: public QThread
     volatile int m_progress;
 };
 
-FileCopyThread::FileCopyThread(IconView *parent, bool move)
-{
-    m_move = move;
-    m_parent = parent;
-}
-
 void FileCopyThread::run()
 {
     QStringList::iterator it;
diff --git a/mythplugins/mythgallery/mythgallery/singleview.cpp b/mythplugins/mythgallery/mythgallery/singleview.cpp
index 505b441..9fd2f1b 100644
--- a/mythplugins/mythgallery/mythgallery/singleview.cpp
+++ b/mythplugins/mythgallery/mythgallery/singleview.cpp
@@ -193,7 +193,7 @@ void SingleView::paintEvent(QPaintEvent *)
                 cmd = "Internal";
                 gContext->GetMainWindow()->HandleMedia(cmd, item->GetPath());
             }
-            else
+            else if (item)
             {
                 QString path = QString("\"%1\"").arg(item->GetPath());
 
