From bdaf1b01bedea5cac8b0d3d15dd48f87f531651c Mon Sep 17 00:00:00 2001
From: Vojtech Kral <vojtech@kral.hk>
Date: Thu, 19 Apr 2018 16:49:22 +0200
Subject: [PATCH] ConfigWizard: Fix reset checkbox

---
 xs/src/slic3r/GUI/ConfigWizard.cpp         | 3 ++-
 xs/src/slic3r/GUI/ConfigWizard_private.hpp | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xs/src/slic3r/GUI/ConfigWizard.cpp b/xs/src/slic3r/GUI/ConfigWizard.cpp
index 0eee234db..a1ee5a748 100644
--- a/xs/src/slic3r/GUI/ConfigWizard.cpp
+++ b/xs/src/slic3r/GUI/ConfigWizard.cpp
@@ -205,7 +205,7 @@ PageWelcome::PageWelcome(ConfigWizard *parent) :
 	ConfigWizardPage(parent, wxString::Format(_(L("Welcome to the Slic3r %s")), ConfigWizard::name()), _(L("Welcome"))),
 	printer_picker(nullptr),
 	others_buttons(new wxPanel(parent)),
-	cbox_reset(new wxCheckBox(this, wxID_ANY, _(L("Remove user profiles - install from scratch (a snapshot will be taken beforehand)"))))
+	cbox_reset(nullptr)
 {
 	if (wizard_p()->flag_startup && wizard_p()->flag_empty_datadir) {
 		wxString::Format(_(L("Run %s")), ConfigWizard::name());
@@ -214,6 +214,7 @@ PageWelcome::PageWelcome(ConfigWizard *parent) :
 			ConfigWizard::name())
 		);
 	} else {
+		cbox_reset = new wxCheckBox(this, wxID_ANY, _(L("Remove user profiles - install from scratch (a snapshot will be taken beforehand)")));
 		append(cbox_reset);
 	}
 
diff --git a/xs/src/slic3r/GUI/ConfigWizard_private.hpp b/xs/src/slic3r/GUI/ConfigWizard_private.hpp
index 8e43ac3ac..cdab2eb3c 100644
--- a/xs/src/slic3r/GUI/ConfigWizard_private.hpp
+++ b/xs/src/slic3r/GUI/ConfigWizard_private.hpp
@@ -107,7 +107,7 @@ struct PageWelcome: ConfigWizardPage
 	virtual wxPanel* extra_buttons() { return others_buttons; }
 	virtual void on_page_set();
 
-	bool reset_user_profile() const { return cbox_reset->GetValue(); }
+	bool reset_user_profile() const { return cbox_reset != nullptr ? cbox_reset->GetValue() : false; }
 	void on_variant_checked();
 };