examples: Check stream_data is null
This commit is contained in:
parent
bbc09b005b
commit
46f5d4b1c4
|
@ -462,7 +462,7 @@ is emitted via ``on_header_callback`` function, which is called after
|
||||||
}
|
}
|
||||||
stream_data = nghttp2_session_get_stream_user_data(session,
|
stream_data = nghttp2_session_get_stream_user_data(session,
|
||||||
frame->hd.stream_id);
|
frame->hd.stream_id);
|
||||||
if(stream_data->request_path) {
|
if(!stream_data || stream_data->request_path) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(namelen == sizeof(PATH) - 1 && memcmp(PATH, name, namelen) == 0) {
|
if(namelen == sizeof(PATH) - 1 && memcmp(PATH, name, namelen) == 0) {
|
||||||
|
@ -580,6 +580,9 @@ is about to close::
|
||||||
http2_stream_data *stream_data;
|
http2_stream_data *stream_data;
|
||||||
|
|
||||||
stream_data = nghttp2_session_get_stream_user_data(session, stream_id);
|
stream_data = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||||
|
if(!stream_data) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
remove_stream(session_data, stream_data);
|
remove_stream(session_data, stream_data);
|
||||||
delete_http2_stream_data(stream_data);
|
delete_http2_stream_data(stream_data);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -410,7 +410,7 @@ static int on_header_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
stream_data = nghttp2_session_get_stream_user_data(session,
|
stream_data = nghttp2_session_get_stream_user_data(session,
|
||||||
frame->hd.stream_id);
|
frame->hd.stream_id);
|
||||||
if(stream_data->request_path) {
|
if(!stream_data || stream_data->request_path) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(namelen == sizeof(PATH) - 1 && memcmp(PATH, name, namelen) == 0) {
|
if(namelen == sizeof(PATH) - 1 && memcmp(PATH, name, namelen) == 0) {
|
||||||
|
@ -529,6 +529,9 @@ static int on_stream_close_callback(nghttp2_session *session,
|
||||||
http2_stream_data *stream_data;
|
http2_stream_data *stream_data;
|
||||||
|
|
||||||
stream_data = nghttp2_session_get_stream_user_data(session, stream_id);
|
stream_data = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||||
|
if(!stream_data) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
remove_stream(session_data, stream_data);
|
remove_stream(session_data, stream_data);
|
||||||
delete_http2_stream_data(stream_data);
|
delete_http2_stream_data(stream_data);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue