1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 10:19:33 +02:00

NPE fixes

This commit is contained in:
Nikolay Pultsin 2011-12-14 00:42:59 +00:00
parent 281b4367e4
commit d9437516fd
3 changed files with 16 additions and 9 deletions

View file

@ -33,14 +33,17 @@ public class FileFirstLevelTree extends FirstLevelTree {
}
private void addChild(String path, String resourceKey) {
final ZLFile file = ZLFile.createFileByPath(path);
if (file != null) {
final ZLResource resource = Library.resource().getResource(resourceKey);
new FileTree(
this,
ZLFile.createFileByPath(path),
file,
resource.getValue(),
resource.getResource("summary").getValue()
);
}
}
@Override
public String getTreeTitle() {

View file

@ -33,7 +33,7 @@ public class FileTree extends LibraryTree {
private final String mySummary;
private final boolean myIsSelectable;
public FileTree(LibraryTree parent, ZLFile file, String name, String summary) {
FileTree(LibraryTree parent, ZLFile file, String name, String summary) {
super(parent);
myFile = file;
myName = name;

View file

@ -217,7 +217,11 @@ public final class NetworkImage extends ZLLoadableImage {
if (path == null) {
return null;
}
myFileImage = new ZLFileImage(mimeType(), ZLFile.createFileByPath(path));
final ZLFile file = ZLFile.createFileByPath(path);
if (file == null) {
return null;
}
myFileImage = new ZLFileImage(mimeType(), file);
}
return myFileImage.inputStream();
}