Commit 8cfff8db97b7e51578424b6a202ae80cd56923a2
1 parent
f33c3a36
添加对可能空指针的判断
Showing
2 changed files
with
7 additions
and
0 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
| ... | ... | @@ -225,6 +225,7 @@ public class SIPRequestHeaderProvider { |
| 225 | 225 | public Request createInfoRequest(Device device, StreamInfo streamInfo, String content, Long cseq) |
| 226 | 226 | throws PeerUnavailableException, ParseException, InvalidArgumentException { |
| 227 | 227 | Request request = null; |
| 228 | + if (streamInfo == null) return null; | |
| 228 | 229 | Dialog dialog = streamSession.getDialog(streamInfo.getDeviceID(), streamInfo.getChannelId()); |
| 229 | 230 | |
| 230 | 231 | SipURI requestLine = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -1589,6 +1589,9 @@ public class SIPCommander implements ISIPCommander { |
| 1589 | 1589 | content.append("CSeq: " + cseq + "\r\n"); |
| 1590 | 1590 | content.append("PauseTime: now\r\n"); |
| 1591 | 1591 | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); |
| 1592 | + if (request == null) { | |
| 1593 | + return; | |
| 1594 | + } | |
| 1592 | 1595 | logger.info(request.toString()); |
| 1593 | 1596 | ClientTransaction clientTransaction = null; |
| 1594 | 1597 | if ("TCP".equals(device.getTransport())) { |
| ... | ... | @@ -1617,6 +1620,7 @@ public class SIPCommander implements ISIPCommander { |
| 1617 | 1620 | content.append("CSeq: " + cseq + "\r\n"); |
| 1618 | 1621 | content.append("Range: npt=now-\r\n"); |
| 1619 | 1622 | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); |
| 1623 | + if (request == null) return; | |
| 1620 | 1624 | logger.info(request.toString()); |
| 1621 | 1625 | ClientTransaction clientTransaction = null; |
| 1622 | 1626 | if ("TCP".equals(device.getTransport())) { |
| ... | ... | @@ -1645,6 +1649,7 @@ public class SIPCommander implements ISIPCommander { |
| 1645 | 1649 | content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n"); |
| 1646 | 1650 | |
| 1647 | 1651 | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); |
| 1652 | + if (request == null) return; | |
| 1648 | 1653 | logger.info(request.toString()); |
| 1649 | 1654 | ClientTransaction clientTransaction = null; |
| 1650 | 1655 | if ("TCP".equals(device.getTransport())) { |
| ... | ... | @@ -1672,6 +1677,7 @@ public class SIPCommander implements ISIPCommander { |
| 1672 | 1677 | content.append("CSeq: " + cseq + "\r\n"); |
| 1673 | 1678 | content.append("Scale: " + String.format("%.1f",speed) + "\r\n"); |
| 1674 | 1679 | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); |
| 1680 | + if (request == null) return; | |
| 1675 | 1681 | logger.info(request.toString()); |
| 1676 | 1682 | ClientTransaction clientTransaction = null; |
| 1677 | 1683 | if ("TCP".equals(device.getTransport())) { | ... | ... |