aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FormatSpec.java9
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java6
2 files changed, 13 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index f85431ee8..555c71b4c 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -379,6 +379,15 @@ public final class FormatSpec {
mHeaderSize = headerSize;
mDictionaryOptions = dictionaryOptions;
mFormatOptions = formatOptions;
+ if (null == getLocaleString()) {
+ throw new RuntimeException("Cannot create a FileHeader without a locale");
+ }
+ if (null == getVersion()) {
+ throw new RuntimeException("Cannot create a FileHeader without a version");
+ }
+ if (null == getId()) {
+ throw new RuntimeException("Cannot create a FileHeader without an ID");
+ }
}
// Helper method to get the locale as a String
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java b/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
index 883709f83..91d9cf345 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
@@ -140,8 +140,10 @@ public class Ver4DictUpdater extends Ver4DictDecoder implements DictUpdater {
@Override
public void deleteWord(final String word) throws IOException, UnsupportedFormatException {
- if (mDictBuffer == null) openDictBuffer();
- readHeader();
+ if (mDictBuffer == null) {
+ openDictBuffer();
+ readHeader();
+ }
final int wordPos = getTerminalPosition(word);
if (wordPos != FormatSpec.NOT_VALID_WORD) {
mDictBuffer.position(wordPos);