Skip to content

Commit

Permalink
Merge pull request #984 from pennam/hostname-fix
Browse files Browse the repository at this point in the history
patch: check for user network interface before reading hostname
  • Loading branch information
pennam authored Oct 29, 2024
2 parents 84c44cd + 4d7047b commit afdf359
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 4292f8b7c4aa38b68d22c413f91bdc95192cfad6 Mon Sep 17 00:00:00 2001
From: pennam <[email protected]>
Date: Tue, 29 Oct 2024 11:30:00 +0100
Subject: [PATCH] Add user network interface check before reading hostname

---
connectivity/lwipstack/source/LWIPInterface.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/connectivity/lwipstack/source/LWIPInterface.cpp b/connectivity/lwipstack/source/LWIPInterface.cpp
index 64869a3538..da964543c7 100644
--- a/connectivity/lwipstack/source/LWIPInterface.cpp
+++ b/connectivity/lwipstack/source/LWIPInterface.cpp
@@ -446,9 +446,11 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
interface->memory_manager = &memory_manager;
interface->ppp_enabled = false;

- hostname = user_network_interface->get_hostname();
- if (hostname) {
- netif_set_hostname(&interface->netif, hostname);
+ if (user_network_interface) {
+ hostname = user_network_interface->get_hostname();
+ if (hostname) {
+ netif_set_hostname(&interface->netif, hostname);
+ }
}

#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
--
2.45.2

0 comments on commit afdf359

Please sign in to comment.