Skip to content

Commit 01519eb

Browse files
facchinmcmaglie
authored andcommitted
Move Sketchbook preparation before Theme.init()
Fixes NPE when searching for themes in portable installation
1 parent 260e0c2 commit 01519eb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

app/src/processing/app/Base.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ public Base(String[] args) throws Exception {
209209
parser.parseArgumentsPhase1();
210210
commandLine = !parser.isGuiMode();
211211

212+
BaseNoGui.checkInstallationFolder();
213+
214+
// If no path is set, get the default sketchbook folder for this platform
215+
if (BaseNoGui.getSketchbookPath() == null) {
216+
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
217+
if (BaseNoGui.getPortableFolder() != null)
218+
PreferencesData.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
219+
else
220+
PreferencesData.set("sketchbook.path", defaultFolder.getAbsolutePath());
221+
if (!defaultFolder.exists()) {
222+
defaultFolder.mkdirs();
223+
}
224+
}
225+
212226
SplashScreenHelper splash;
213227
if (parser.isGuiMode()) {
214228
// Setup all notification widgets
@@ -243,20 +257,6 @@ public Base(String[] args) throws Exception {
243257
untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
244258
DeleteFilesOnShutdown.add(untitledFolder);
245259

246-
BaseNoGui.checkInstallationFolder();
247-
248-
// If no path is set, get the default sketchbook folder for this platform
249-
if (BaseNoGui.getSketchbookPath() == null) {
250-
File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
251-
if (BaseNoGui.getPortableFolder() != null)
252-
PreferencesData.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
253-
else
254-
PreferencesData.set("sketchbook.path", defaultFolder.getAbsolutePath());
255-
if (!defaultFolder.exists()) {
256-
defaultFolder.mkdirs();
257-
}
258-
}
259-
260260
splash.splashText(tr("Initializing packages..."));
261261
BaseNoGui.initPackages();
262262

0 commit comments

Comments
 (0)