Maelstrom: Make sure that we get a valid preferences path

https://github.com/libsdl-org/Maelstrom/commit/017cc43e871fc8092e571f298cb835791dd238c2

From 017cc43e871fc8092e571f298cb835791dd238c2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 25 Jun 2012 12:10:17 -0400
Subject: [PATCH] Make sure that we get a valid preferences path

---
 game/main.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/game/main.cpp b/game/main.cpp
index 9d337b3e..cc569c5a 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -245,9 +245,13 @@ InitFilesystem(const char *argv0)
 
 	// Set up the write directory for this platform
 	prefspath = PHYSFS_getPrefDir(MAELSTROM_ORGANIZATION, MAELSTROM_NAME);
+	if (!prefspath) {
+		error("Couldn't get preferences path for this platform\n");
+		return false;
+	}
 	if (!PHYSFS_setWriteDir(prefspath)) {
-			error("Couldn't set write directory to %s: %s\n", prefspath, PHYSFS_getLastError());
-			return false;
+		error("Couldn't set write directory to %s: %s\n", prefspath, PHYSFS_getLastError());
+		return false;
 	}
 
 	/* Put the write directory first in the search path */