Commit 3b7f5d479caf9b51e99da9940619db720637d5b4
1 parent
1247c5f7
Avoid crash if -redir or -smb used without -net user.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1760 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
3 additions
and
1 deletions
vl.c
| ... | ... | @@ -1926,7 +1926,7 @@ static VLANClientState *slirp_vc; |
| 1926 | 1926 | |
| 1927 | 1927 | int slirp_can_output(void) |
| 1928 | 1928 | { |
| 1929 | - return qemu_can_send_packet(slirp_vc); | |
| 1929 | + return !slirp_vc || qemu_can_send_packet(slirp_vc); | |
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | 1932 | void slirp_output(const uint8_t *pkt, int pkt_len) |
| ... | ... | @@ -1935,6 +1935,8 @@ void slirp_output(const uint8_t *pkt, int pkt_len) |
| 1935 | 1935 | printf("slirp output:\n"); |
| 1936 | 1936 | hex_dump(stdout, pkt, pkt_len); |
| 1937 | 1937 | #endif |
| 1938 | + if (!slirp_vc) | |
| 1939 | + return; | |
| 1938 | 1940 | qemu_send_packet(slirp_vc, pkt, pkt_len); |
| 1939 | 1941 | } |
| 1940 | 1942 | ... | ... |