Skip to content

Commit

Permalink
initialize Storage before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed Dec 27, 2024
1 parent 1077d60 commit 9a24841
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/nodejs-shell/src/MatterNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export class MatterNode {
*/

if (this.#environment) {
const controllerStore = this.#environment.get(ControllerStore);
if (resetStorage) {
await controllerStore.erase();
}
this.storageContext = controllerStore.storage.createContext("Node");

if (this.netInterface !== undefined) {
this.#environment.vars.set("mdns.networkinterface", this.netInterface);
}
Expand All @@ -65,12 +71,6 @@ export class MatterNode {
});
await this.commissioningController.initializeControllerStore();

const controllerStore = this.#environment.get(ControllerStore);
if (resetStorage) {
await controllerStore.erase();
}
this.storageContext = controllerStore.storage.createContext("Node");

const storageService = this.#environment.get(StorageService);
const baseLocation = storageService.location;
if (baseLocation !== undefined) {
Expand Down

0 comments on commit 9a24841

Please sign in to comment.