MainWindow: Fix "main_window may be uninitialized" error
authorSoeren Apel <soeren@apelpie.net>
Sun, 4 Dec 2016 13:38:32 +0000 (14:38 +0100)
committerSoeren Apel <soeren@apelpie.net>
Sun, 4 Dec 2016 13:38:32 +0000 (14:38 +0100)
pv/mainwindow.cpp

index a47089620c6c1239f2adc5a565d8346bbec007f3..7fe09fb732e9789ca8be26a958a4057a50e5a0fe 100644 (file)
@@ -161,7 +161,7 @@ shared_ptr<views::ViewBase> MainWindow::get_active_view() const
 shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
        views::ViewType type, Session &session)
 {
 shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
        views::ViewType type, Session &session)
 {
-       QMainWindow *main_window;
+       QMainWindow *main_window = nullptr;
        for (auto entry : session_windows_)
                if (entry.first.get() == &session)
                        main_window = entry.second;
        for (auto entry : session_windows_)
                if (entry.first.get() == &session)
                        main_window = entry.second;