Issue #5480 - NPE protection on IO.delete(File)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-10-20 16:28:36 -05:00
parent 4ecaf3049c
commit 0e98c370fd
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 4 additions and 1 deletions

View File

@ -361,10 +361,13 @@ public class IO
* This delete will recursively delete directories - BE CAREFUL
*
* @param file The file (or directory) to be deleted.
* @return true if anything was deleted. (note: this does not mean that all content in a directory was deleted)
* @return true if file was deleted, or directory referenced was deleted.
* false if file doesn't exist, or was null.
*/
public static boolean delete(File file)
{
if (file == null)
return false;
if (!file.exists())
return false;
if (file.isDirectory())