- // Convert the file name URI to a file name path.
- String fileNamePath = fileNameHelper.convertUriToFileNamePath(data.getData());
+ // Get the file name URI from the intent.
+ Uri fileNameUri= data.getData();
+
+ // Process the file name URI if it is not null.
+ if (fileNameUri != null) {
+ // Convert the file name URI to a file name path.
+ String fileNamePath = fileNameHelper.convertUriToFileNamePath(fileNameUri);