Skip to content

Commit 423234a

Browse files
committed
Avoid null dereference if directory is empty
1 parent db94d18 commit 423234a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/src/main/java/videoeditor/bhuvnesh/com/ffmpegvideoeditor/activity/PreviewImageActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4646
tvInstruction.setText("Images stored at path "+filePath);
4747
File[] listFile;
4848

49-
listFile = dir.listFiles();
49+
listFile = dir.listFiles();
5050

51-
52-
53-
for(File e:listFile)
51+
if(listFile != null)
5452
{
55-
f.add(e.getAbsolutePath());
53+
for(File e:listFile)
54+
{
55+
f.add(e.getAbsolutePath());
56+
}
5657
}
5758

5859
PreviewImageAdapter rcAdapter = new PreviewImageAdapter( f);

0 commit comments

Comments
 (0)