ICU-4883 Handle null return from detect().
X-SVN-Rev: 18698
This commit is contained in:
parent
e4af6d8e87
commit
fc79f6822d
@ -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…
Reference in New Issue
Block a user