From b0c1ce714f96d7cf09eec99d5edf8b9193bff719 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 5 Jul 2021 17:14:47 +0200 Subject: [PATCH] fix coverity CID 350569 --- client/src/proxguiqt.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/src/proxguiqt.cpp b/client/src/proxguiqt.cpp index 2194b8bdc..db092c550 100644 --- a/client/src/proxguiqt.cpp +++ b/client/src/proxguiqt.cpp @@ -105,8 +105,13 @@ void ProxGuiQT::_HideGraphWindow(void) { // picture viewer void ProxGuiQT::_ShowPictureWindow(char *fn) { + + if (!plotapp) + return; + if (fn == NULL) return; + size_t slen = strlen(fn); if (slen == 0) return; @@ -117,9 +122,6 @@ void ProxGuiQT::_ShowPictureWindow(char *fn) { memcpy(myfn, fn, slen); - if (!plotapp) - return; - if (!pictureWidget) { #if defined(__MACH__) && defined(__APPLE__) @@ -191,11 +193,6 @@ void ProxGuiQT::_StartProxmarkThread(void) { void ProxGuiQT::MainLoop() { plotapp = new QApplication(argc, argv); - // Setup the picture widget - pictureWidget = new QWidget(); - pictureController = new Ui::PictureForm(); - pictureController->setupUi(pictureWidget); - connect(this, SIGNAL(ShowGraphWindowSignal()), this, SLOT(_ShowGraphWindow())); connect(this, SIGNAL(RepaintGraphWindowSignal()), this, SLOT(_RepaintGraphWindow())); connect(this, SIGNAL(HideGraphWindowSignal()), this, SLOT(_HideGraphWindow())); @@ -222,6 +219,11 @@ void ProxGuiQT::MainLoop() { ProxGuiQT::ProxGuiQT(int argc, char **argv, WorkerThread *wthread) : plotapp(NULL), plotwidget(NULL), argc(argc), argv(argv), proxmarkThread(wthread) { + + // Setup the picture widget + pictureWidget = new QWidget(); + pictureController = new Ui::PictureForm(); + pictureController->setupUi(pictureWidget); } ProxGuiQT::~ProxGuiQT(void) {