mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 76ead0ea: Fix a possible crash
* commit '76ead0ead06ab1c09c698247c19d1d2f4bd35d23': Fix a possible crash
This commit is contained in:
commit
81e13359a7
@ -68,9 +68,13 @@ final class BinaryDictionaryGetter {
|
|||||||
/**
|
/**
|
||||||
* Generates a unique temporary file name in the app cache directory.
|
* Generates a unique temporary file name in the app cache directory.
|
||||||
*/
|
*/
|
||||||
public static String getTempFileName(String id, Context context) throws IOException {
|
public static String getTempFileName(final String id, final Context context)
|
||||||
return File.createTempFile(DictionaryInfoUtils.replaceFileNameDangerousCharacters(id),
|
throws IOException {
|
||||||
null).getAbsolutePath();
|
final String safeId = DictionaryInfoUtils.replaceFileNameDangerousCharacters(id);
|
||||||
|
// If the first argument is less than three chars, createTempFile throws a
|
||||||
|
// RuntimeException. We don't really care about what name we get, so just
|
||||||
|
// put a three-chars prefix makes us safe.
|
||||||
|
return File.createTempFile("xxx" + safeId, null).getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user