diff --git a/src/windows/native/sun/windows/awt_FileDialog.cpp b/src/windows/native/sun/windows/awt_FileDialog.cpp index d60fbd329b1667b4a71d3508c2c6a6681840d32d..276f3647e688e5476d0147ff781d7d3dbdfe3bb6 100644 --- a/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -372,7 +372,9 @@ AwtFileDialog::Show(void *p) // Report result to peer. if (result) { - jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile); + jint length = multipleMode + ? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile) + : (jint)_tcslen(ofn.lpstrFile); jcharArray jnames = env->NewCharArray(length); env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile);