mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-4883 Handle null return from detect().
X-SVN-Rev: 18698
This commit is contained in:
parent
e4af6d8e87
commit
fc79f6822d
1 changed files with 15 additions and 2 deletions
|
@ -246,7 +246,13 @@ public class CharsetDetector {
|
|||
try {
|
||||
setText(in);
|
||||
|
||||
return detect().getReader();
|
||||
CharsetMatch match = detect();
|
||||
|
||||
if (match == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return match.getReader();
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -275,7 +281,14 @@ public class CharsetDetector {
|
|||
|
||||
try {
|
||||
setText(in);
|
||||
return detect().getString(-1);
|
||||
|
||||
CharsetMatch match = detect();
|
||||
|
||||
if (match == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return match.getString(-1);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue