← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~aber/widelands/0x0000000000000000 into lp:widelands

 

David Allwicher has proposed merging lp:~aber/widelands/0x0000000000000000 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~aber/widelands/0x0000000000000000/+merge/50681

I don't know if this code is semantically equivalent, but we need to make sure we don't access 0x0000000000000000.
So, i'm still not able to make a new widelands package. :'(
The problem is, if you start from the console, the console is your parent process and you have a different environment. So I did not notice this at first.
-- 
https://code.launchpad.net/~aber/widelands/0x0000000000000000/+merge/50681
Your team Widelands Developers is requested to review the proposed merge of lp:~aber/widelands/0x0000000000000000 into lp:widelands.
=== modified file 'src/i18n.cc'
--- src/i18n.cc	2011-02-16 18:51:00 +0000
+++ src/i18n.cc	2011-02-22 01:52:08 +0000
@@ -116,16 +116,22 @@
  * Code inspired by wesnoth.org
  */
 void init_locale() {
+	env_locale = std::string();
 #ifdef _WIN32
-	env_locale = "";
 	locale = "English";
 	SETLOCALE(LC_ALL, "English");
 #else
 	// first, save environment variable
-	env_locale = getenv("LANG");
-	if (env_locale.empty())
-		env_locale = getenv("LANGUAGE");
-
+	char * lang;
+	lang = getenv("LANG");
+	if (lang != NULL) {
+		env_locale = lang;
+	} else {
+		lang = getenv("LANGUAGE");
+		if (lang != NULL) {
+			env_locale = lang;
+		}
+	}
 	locale = "C";
 	SETLOCALE(LC_ALL, "C");
 	SETLOCALE(LC_MESSAGES, "");