Handle the case locale is 'C' in wchar-char-test.
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Thu, 27 Apr 2017 12:26:54 +0000 (21:26 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Thu, 27 Apr 2017 12:26:54 +0000 (21:26 +0900)
test/src/wchar-char-test.c

index 2763854b8a01243d2489cdaf203a021e5141ee48..a7637061356ae2d37765226692ff41938a3131a8 100644 (file)
@@ -61,7 +61,8 @@ int main(int argc, char **argv)
    };
 
    loc = setlocale(LC_ALL, "");
-   if (NULL != (ptr = strchr(loc, '.')))
+   if (NULL != loc &&
+       NULL != (ptr = strchr(loc, '.')))
    {
        int i;
 
@@ -74,11 +75,11 @@ int main(int argc, char **argv)
                break;
            }
        }
-       if (testsw < 0)
-       {
-           printf("Unfortunately can't handle this locale\n");
-           exit(0);
-       }
+   }
+   if (testsw < 0)
+   {
+       printf("Unfortunately can't handle this locale\n");
+       exit(0);
    }
    test_connect_ext("");