loader: add null check to loaderValidateLayers

The loader will now make sure to check if utf8 is null before
validating the string, preventing needless segfaults.

Change-Id: I48139e56719e3c518b85f2ded1ca0b682447413f
diff --git a/loader/loader.c b/loader/loader.c
index 1ba1b30..c57c789 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -7237,6 +7237,10 @@
     int num_char_bytes = 0;
     int i, j;
 
+    if (utf8 == NULL) {
+        return VK_STRING_ERROR_NULL_PTR;
+    }
+
     for (i = 0; i <= max_length; i++) {
         if (utf8[i] == 0) {
             break;
diff --git a/loader/loader.h b/loader/loader.h
index 7e6d601..5e94955 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -67,6 +67,7 @@
     VK_STRING_ERROR_NONE = 0x00000000,
     VK_STRING_ERROR_LENGTH = 0x00000001,
     VK_STRING_ERROR_BAD_DATA = 0x00000002,
+    VK_STRING_ERROR_NULL_PTR = 0x00000004,
 } VkStringErrorFlagBits;
 typedef VkFlags VkStringErrorFlags;