Check return value of setlocale().

setlocale() is allowed to return NULL.  In particular, this happens on
Bionic (Android's libc) because it doesn't support C locales.