diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index a51f3573f85786..d11fc9e676932d 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -100,7 +100,7 @@ CHIP_ERROR AutoCommissioner::SetCommissioningParameters(const CommissioningParam if (params.GetCountryCode().HasValue()) { - auto & code = params.GetCountryCode().Value(); + auto code = params.GetCountryCode().Value(); MutableCharSpan copiedCode(mCountryCode); if (CopyCharSpanToMutableCharSpan(code, copiedCode) == CHIP_NO_ERROR) {