Details
-
Type: Bug
-
Status: Closed (View Workflow)
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.1
-
Fix Version/s: 1.6.1
-
Component/s: o.c.jsword.book.sword
-
Labels:None
-
Environment:
All
Description
A null check is required in the following code in GenBookBackend.getRawText because find can return a null meaning that node, when used on the next line could be null:
DataPolice.setKey(key);
TreeNode node = find(key);
byte[] userData = node.getUserData();
// Some entries may be empty.
if (userData.length == 8) {
Here is a suggested fix but I don't know if you should return a null or an empty string in this scenario:
DataPolice.setKey(key);
TreeNode node = find(key);
// Is there an entry?
if (node == null)
byte[] userData = node.getUserData();
Here is a simple test:
Book book = getBook("Pilgrim");
Key key = book.getGlobalKeyList();
String rawText = book.getRawText(key);