File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,10 @@ bool rfc3261_18_3_request() {
104104 int len = Utils .str_utf8_length (message.body);
105105 dynamic contentLength = message.getHeader ('content-length' );
106106
107- if (contentLength is String ) {
107+ if (contentLength != null && contentLength is String ) {
108108 contentLength = int .tryParse (contentLength) ?? 0 ;
109+ } else {
110+ contentLength = 0 ;
109111 }
110112
111113 if (len < contentLength) {
@@ -192,8 +194,10 @@ bool rfc3261_18_3_response() {
192194 // ignore: always_specify_types
193195 var contentLength = message.getHeader ('content-length' );
194196
195- if (contentLength is String ) {
197+ if (contentLength != null && contentLength is String ) {
196198 contentLength = int .tryParse (contentLength) ?? 0 ;
199+ } else {
200+ contentLength = 0 ;
197201 }
198202
199203 if (len < contentLength) {
Original file line number Diff line number Diff line change @@ -23,25 +23,25 @@ class WebSocketImpl {
2323 try {
2424 _socket = WebSocket (_url, 'sip' );
2525 _socket.onOpen.listen ((Event e) {
26- this ? . onOpen ();
26+ onOpen ? . call ();
2727 });
2828
2929 _socket.onMessage.listen ((MessageEvent e) async {
3030 if (e.data is Blob ) {
3131 dynamic arrayBuffer = await JSUtils .promiseToFuture (
3232 JSUtils .callMethod (e.data, 'arrayBuffer' , < Object > []));
3333 String message = String .fromCharCodes (arrayBuffer.asUint8List ());
34- this ? . onMessage (message);
34+ onMessage ? . call (message);
3535 } else {
36- this ? . onMessage (e.data);
36+ onMessage ? . call (e.data);
3737 }
3838 });
3939
4040 _socket.onClose.listen ((CloseEvent e) {
41- this ? . onClose (e.code, e.reason);
41+ onClose ? . call (e.code, e.reason);
4242 });
4343 } catch (e) {
44- this ? . onClose (e.code, e.reason);
44+ onClose ? . call (e.code, e.reason);
4545 }
4646 }
4747
You can’t perform that action at this time.
0 commit comments