Skip to content

Commit bfb53f0

Browse files
authored
Merge pull request #31 from virxkane/findindict_20180808_fix
Android: fixed crash on opening dictionary with invalid settings.
2 parents 42ed833 + 29278be commit bfb53f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

android/src/org/coolreader/Dictionaries.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@ public DictionaryException(String msg) {
160160
public void findInDictionary(String s) throws DictionaryException {
161161
log.d("lookup in dictionary: " + s);
162162
DictInfo curDict = currentDictionary;
163-
if (iDic2IsActive > 0)
163+
if (iDic2IsActive > 0 && currentDictionary2 != null)
164164
curDict = currentDictionary2;
165165
if (iDic2IsActive > 1)
166166
iDic2IsActive = 0;
167167
if (currentDictionary3 != null)
168168
curDict = currentDictionary3;
169169
currentDictionary3 = null;
170+
if (null == curDict) {
171+
throw new DictionaryException("Current dictionary are invalid!");
172+
}
170173
switch (curDict.internal) {
171174
case 0:
172175
Intent intent0 = new Intent(curDict.action);

0 commit comments

Comments
 (0)