Fix a bug introduced in obex cleanup

Avoid exception when an empty array is passed to convert to Unicode
Before cleanup, there used to be an empty try/catch
This commit is contained in:
Tao Liejun
2009-07-15 17:56:32 -07:00
committed by Nick Pelly
parent 2debd56b5b
commit 8d95d0a13a

View File

@@ -875,7 +875,7 @@ public final class ObexHelper {
* @throws IllegalArgumentException if the byte array has an odd length
*/
public static String convertToUnicode(byte[] b, boolean includesNull) {
if (b == null) {
if (b == null || b.length == 0) {
return null;
}
int arrayLength = b.length;