fix: Cannot read properties of undefined (reading '$location')

This commit is contained in:
pa
2025-11-12 19:02:20 +09:00
committed by Natsumi
parent 957a69f745
commit c48d540722

View File

@@ -540,7 +540,7 @@ export const useInstanceStore = defineStore('Instance', () => {
};
}
}
const { instanceId, shortName } = D.$location;
const { instanceId, shortName } = D?.$location || {};
if (instanceId && typeof instances[instanceId] === 'undefined') {
instances[instanceId] = {
id: instanceId,
@@ -555,7 +555,7 @@ export const useInstanceStore = defineStore('Instance', () => {
const cachedCurrentUser = userStore.cachedUsers.get(
userStore.currentUser.id
);
const lastLocation$ = cachedCurrentUser.$location;
const lastLocation$ = cachedCurrentUser?.$location;
const playersInInstance = locationStore.lastLocation.playerList;
if (lastLocation$.worldId === D.id && playersInInstance.size > 0) {
// pull instance json from cache