ICU-4883 Handle null return from detect().

X-SVN-Rev: 18698
This commit is contained in:
Eric Mader 2005-10-18 16:50:15 +00:00
parent e4af6d8e87
commit fc79f6822d

View File

@ -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;
}