diff --git a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp index 6d0d4f7114d608..aadf5e970d8d3b 100644 --- a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp +++ b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp @@ -106,8 +106,8 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a case Attributes::RoutingRole::Id: { using ThreadNetworkDiagnostics::RoutingRoleEnum; - RoutingRoleEnum routingRole; - otDeviceRole otRole = otThreadGetDeviceRole(otInst); + RoutingRoleEnum routingRole = RoutingRoleEnum::kUnspecified; + otDeviceRole otRole = otThreadGetDeviceRole(otInst); if (otRole == OT_DEVICE_ROLE_DISABLED) {