< prev index next >

src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -203,19 +203,23 @@
 // To call real JNU_NewStringPlatform
 #undef JNU_NewStringPlatform
 static jstring jstringFromSTRRET(JNIEnv* env, LPITEMIDLIST pidl, STRRET* pStrret) {
     switch (pStrret->uType) {
         case STRRET_CSTR :
+            if (pStrret->cStr != NULL) {
             return JNU_NewStringPlatform(env, reinterpret_cast<const char*>(pStrret->cStr));
+            }
         case STRRET_OFFSET :
             // Note : this may need to be WCHAR instead
             return JNU_NewStringPlatform(env,
                                          (CHAR*)pidl + pStrret->uOffset);
         case STRRET_WSTR :
+            if (pStrret->pOleStr != NULL) {
             return env->NewString(reinterpret_cast<const jchar*>(pStrret->pOleStr),
                 static_cast<jsize>(wcslen(pStrret->pOleStr)));
     }
+    }
     return NULL;
 }
 // restoring the original definition
 #define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<jchar*>(x), static_cast<jsize>(_tcslen(x)))
 
< prev index next >