提交 588b1f2c 编写于 作者: A anthony

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: NMatt <melkor@orangepalantir.org>
上级 61fa3c80
...@@ -76,9 +76,12 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { ...@@ -76,9 +76,12 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
accessor.setFiles(fd, null, null); accessor.setFiles(fd, null, null);
} else { } else {
// Fix 6987233: add the trailing slash if it's absent // Fix 6987233: add the trailing slash if it's absent
accessor.setDirectory(fd, directory + String with_separator = directory;
(directory.endsWith(File.separator) ? if (directory != null) {
"" : File.separator)); with_separator = directory.endsWith(File.separator) ?
directory : (directory + File.separator);
}
accessor.setDirectory(fd, with_separator);
accessor.setFile(fd, filenames[0]); accessor.setFile(fd, filenames[0]);
accessor.setFiles(fd, directory, filenames); accessor.setFiles(fd, directory, filenames);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册