# HG changeset patch # User anthony # Date 1326899366 -14400 # Node ID c40240392a011ead6187922ad7ae8cf71ec8e42e # Parent 9d4e3b71c122c020bcde3985ab4dac9e1381b79d 7130662: GTK file dialog crashes with a NPE Summary: Guard adding a back slash to the directory name with an if (!= null) check Reviewed-by: anthony, art Contributed-by: Matt diff -r 9d4e3b71c122 -r c40240392a01 jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java --- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java Tue Jan 17 19:09:32 2012 +0400 +++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java Wed Jan 18 19:09:26 2012 +0400 @@ -76,9 +76,12 @@ accessor.setFiles(fd, null, null); } else { // Fix 6987233: add the trailing slash if it's absent - accessor.setDirectory(fd, directory + - (directory.endsWith(File.separator) ? - "" : File.separator)); + String with_separator = directory; + if (directory != null) { + with_separator = directory.endsWith(File.separator) ? + directory : (directory + File.separator); + } + accessor.setDirectory(fd, with_separator); accessor.setFile(fd, filenames[0]); accessor.setFiles(fd, directory, filenames); }