mirror of
https://github.com/espressif/openthread.git
synced 2026-07-16 09:04:10 +00:00
[cli] fix GetOwner function for console cli backend (#3486)
Current implementation of GetOwner function for single-instance CLI assumed that `cli_uart` backend is used. This caused application crash when different backend was used and `cli_uart` was not initialized (and in result sUartServer static pointer was not set). This commit fixes the issue by moving static CLI Server pointer and the mInterpreter field to the to the base Server class and providing getter method to obtain the Interpreter instance. With this approach, any backend derived from the Server class will be able to initialize the static pointer and will provide a valid reference to the Interpreter class instance. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
committed by
Jonathan Hui
parent
b1686c61f4
commit
9cb48245e5
+1
-1
@@ -3916,7 +3916,7 @@ Interpreter &Interpreter::GetOwner(OwnerLocator &aOwnerLocator)
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aOwnerLocator);
|
||||
|
||||
Interpreter &interpreter = Uart::sUartServer->GetInterpreter();
|
||||
Interpreter &interpreter = Server::sServer->GetInterpreter();
|
||||
#endif
|
||||
return interpreter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user