aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2021-11-06 09:09:32 +0000
committerAndy Green <andy@warmcat.com>2021-11-08 10:33:12 +0000
commitc42c2adba949677c0e5f49b307d1f45aaf849101 (patch)
tree73dd48d87807ff7dce7edfe0bed20cdb10d3b0f4 /lib
parent897eb024319a5d233d908e404a00298240cd0edb (diff)
downloadlibwebsockets-c42c2adba949677c0e5f49b307d1f45aaf849101.tar.gz
retry: handle empty retry table
Diffstat (limited to 'lib')
-rw-r--r--lib/core-net/network.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/core-net/network.c b/lib/core-net/network.c
index 6c155302..4ba98a1f 100644
--- a/lib/core-net/network.c
+++ b/lib/core-net/network.c
@@ -417,11 +417,13 @@ lws_retry_get_delay_ms(struct lws_context *context,
*conceal = 0;
if (retry) {
- if (*ctry < retry->retry_ms_table_count)
- ms = retry->retry_ms_table[*ctry];
- else
- ms = retry->retry_ms_table[
- retry->retry_ms_table_count - 1];
+ if (retry->retry_ms_table_count) {
+ if (*ctry < retry->retry_ms_table_count)
+ ms = retry->retry_ms_table[*ctry];
+ else
+ ms = retry->retry_ms_table[
+ retry->retry_ms_table_count - 1];
+ }
/* if no percent given, use the default 30% */
if (retry->jitter_percent)