[PATCH] scan: add guard to check that results->sr is set to avoid segfault issue.

Daniel Bond
2024-09-03T19:27:36Z

Patch created by loqs in Archlinux issue: https://gitlab.archlinux.org/archlinux/packaging/packages/iwd/-/issues/5

As mentioned in list: https://lore.kernel.org/iwd/4083bf62-20d2-46e6-bfae-c926c2acbfe9@gmail.com/
---
src/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/scan.c b/src/scan.c
index debdeb1f..e5360d1b 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -2056,7 +2056,7 @@ static void get_survey_done(void *user_data)

sc->get_survey_cmd_id = 0;

- if (!results->sr->canceled)
+ if (results->sr && !results->sr->canceled)
get_results(results);
else
get_scan_done(user_data);
--
2.46.0