diff options
author | Wink Saville <wink@google.com> | 2011-03-23 15:47:25 -0700 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2011-03-23 15:47:25 -0700 |
commit | 6b68779ab31f410acb3036eafba73d0781db4d91 (patch) | |
tree | 4ce125af45035a0cf8954ee1e464c596a169d25c /telephony | |
parent | 0b6d044567b9c3004eb7ed826fd593019cd24352 (diff) | |
download | frameworks_base-6b68779ab31f410acb3036eafba73d0781db4d91.zip frameworks_base-6b68779ab31f410acb3036eafba73d0781db4d91.tar.gz frameworks_base-6b68779ab31f410acb3036eafba73d0781db4d91.tar.bz2 |
Fix NPE in CatService.encodeOptionalTags.
If cmdDet.typeOfCommand is bad fromInt returns null we now log the
error instead of causing a Null Pointer Exception.
Change-Id: Id6a0d295d988c2bdbd46a0c0dd6b20f5baf02b27
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/cat/CatService.java | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/telephony/java/com/android/internal/telephony/cat/CatService.java b/telephony/java/com/android/internal/telephony/cat/CatService.java index 36059ad..a6c7777 100644 --- a/telephony/java/com/android/internal/telephony/cat/CatService.java +++ b/telephony/java/com/android/internal/telephony/cat/CatService.java @@ -375,25 +375,30 @@ public class CatService extends Handler implements AppInterface { private void encodeOptionalTags(CommandDetails cmdDet, ResultCode resultCode, Input cmdInput, ByteArrayOutputStream buf) { - switch (AppInterface.CommandType.fromInt(cmdDet.typeOfCommand)) { - case GET_INKEY: - // ETSI TS 102 384,27.22.4.2.8.4.2. - // If it is a response for GET_INKEY command and the response timeout - // occured, then add DURATION TLV for variable timeout case. - if ((resultCode.value() == ResultCode.NO_RESPONSE_FROM_USER.value()) && - (cmdInput != null) && (cmdInput.duration != null)) { - getInKeyResponse(buf, cmdInput); - } - break; - case PROVIDE_LOCAL_INFORMATION: - if ((cmdDet.commandQualifier == CommandParamsFactory.LANGUAGE_SETTING) && - (resultCode.value() == ResultCode.OK.value())) { - getPliResponse(buf); - } - break; - default: - CatLog.d(this, "encodeOptionalTags() Unsupported Cmd:" + cmdDet.typeOfCommand); - break; + CommandType cmdType = AppInterface.CommandType.fromInt(cmdDet.typeOfCommand); + if (cmdType != null) { + switch (cmdType) { + case GET_INKEY: + // ETSI TS 102 384,27.22.4.2.8.4.2. + // If it is a response for GET_INKEY command and the response timeout + // occured, then add DURATION TLV for variable timeout case. + if ((resultCode.value() == ResultCode.NO_RESPONSE_FROM_USER.value()) && + (cmdInput != null) && (cmdInput.duration != null)) { + getInKeyResponse(buf, cmdInput); + } + break; + case PROVIDE_LOCAL_INFORMATION: + if ((cmdDet.commandQualifier == CommandParamsFactory.LANGUAGE_SETTING) && + (resultCode.value() == ResultCode.OK.value())) { + getPliResponse(buf); + } + break; + default: + CatLog.d(this, "encodeOptionalTags() Unsupported Cmd:" + cmdDet.typeOfCommand); + break; + } + } else { + CatLog.d(this, "encodeOptionalTags() bad Cmd:" + cmdDet.typeOfCommand); } } |