1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +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,13 +33,16 @@ public class FileFirstLevelTree extends FirstLevelTree {
} }
private void addChild(String path, String resourceKey) { private void addChild(String path, String resourceKey) {
final ZLResource resource = Library.resource().getResource(resourceKey); final ZLFile file = ZLFile.createFileByPath(path);
new FileTree( if (file != null) {
this, final ZLResource resource = Library.resource().getResource(resourceKey);
ZLFile.createFileByPath(path), new FileTree(
resource.getValue(), this,
resource.getResource("summary").getValue() file,
); resource.getValue(),
resource.getResource("summary").getValue()
);
}
} }
@Override @Override

View file

@ -33,7 +33,7 @@ public class FileTree extends LibraryTree {
private final String mySummary; private final String mySummary;
private final boolean myIsSelectable; 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); super(parent);
myFile = file; myFile = file;
myName = name; myName = name;

View file

@ -217,7 +217,11 @@ public final class NetworkImage extends ZLLoadableImage {
if (path == null) { if (path == null) {
return 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(); return myFileImage.inputStream();
} }