segsegv with NULL lang

This commit is contained in:
p.kosyh 2009-09-12 06:54:00 +00:00
parent cdd13c51cd
commit ce58f7e5a1
2 changed files with 5 additions and 4 deletions

View file

@ -14,8 +14,8 @@ LUA_LFLAGS=$(shell pkg-config --libs lua5.1)
# for arch linux (may be others) use this
#
# LUA_CFLAGS=$(shell pkg-config --cflags lua)
# LUA_LFLAGS=$(shell pkg-config --libs lua)
LUA_CFLAGS=$(shell pkg-config --cflags lua)
LUA_LFLAGS=$(shell pkg-config --libs lua)
#
SDL_CFLAGS=$(shell sdl-config --cflags)

View file

@ -28,8 +28,9 @@ void nsleep(int u)
char *game_locale(void)
{
char *p;
char *s = strdup(getenv("LANG"));
if (!s)
char *s;
p = getenv("LANG");
if (!p || !(s = strdup(p)))
return NULL;
if ((p = strchr(s, '_')))
*p = 0;