From 97a40d030f92458976356058cc9746f881902221 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Wed, 19 Feb 2014 12:35:58 +0900 Subject: [PATCH] Throw exception when the header cannot be read. Bug: 13066902 Change-Id: I8fd0f361a4ca55aaab8a2bd2e11f48f92b87fc93 --- .../android/inputmethod/latin/makedict/Ver2DictDecoder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java index 315bd8e58..71e120c5f 100644 --- a/java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java +++ b/java/src/com/android/inputmethod/latin/makedict/Ver2DictDecoder.java @@ -173,6 +173,9 @@ public class Ver2DictDecoder extends AbstractDictDecoder { @Override public DictionaryHeader readHeader() throws IOException, UnsupportedFormatException { final DictionaryHeader header = mBinaryDictionary.getHeader(); + if (header == null) { + throw new IOException("Cannot read the dictionary header."); + } if (header.mFormatOptions.mVersion != FormatSpec.VERSION2) { throw new UnsupportedFormatException("File header has a wrong version : " + header.mFormatOptions.mVersion);