Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit 860f540

Browse files
committed
Catch incomplete objects from ws pipeline
1 parent 7aee88f commit 860f540

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

vrcpy/wss.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from vrcpy import Client, AClient, objects, aobjects
2-
from vrcpy.errors import WebSocketError, WebSocketOpenedError
2+
from vrcpy.errors import WebSocketError, WebSocketOpenedError, IntegretyError
33
import threading
44
import websocket
55
import asyncio
@@ -92,10 +92,19 @@ def _ws_friend_active(self, content):
9292
self.on_friend_active(objects.User(self, content["user"]))
9393

9494
def _ws_friend_location(self, content):
95-
world = objects.World(self, content["world"])
9695
user = objects.User(self, content["user"])
96+
97+
if content["location"] == "private":
98+
self.on_friend_location(user, None, None, None)
99+
return
100+
101+
try:
102+
world = objects.World(self, content["world"])
103+
except IntegretyError:
104+
world = self.fetch_world(content["world"]["id"])
105+
106+
instance = world.fetch_instance(content["instance"])
97107
location = objects.Location(self, content["location"])
98-
instance = objects.Instance(self, content["instance"])
99108

100109
self.on_friend_location(user, world, location, instance)
101110

@@ -162,10 +171,19 @@ async def _ws_friend_active(self, content):
162171
await self.on_friend_active(aobjects.User(self, content["user"]))
163172

164173
async def _ws_friend_location(self, content):
165-
world = aobjects.World(self, content["world"])
166174
user = aobjects.User(self, content["user"])
175+
176+
if content["location"] == "private":
177+
await self.on_friend_location(user, None, None, None)
178+
return
179+
180+
try:
181+
world = aobjects.World(self, content["world"])
182+
except IntegretyError:
183+
world = await self.fetch_world(content["world"]["id"])
184+
185+
instance = await world.fetch_instance(content["instance"])
167186
location = aobjects.Location(self, content["location"])
168-
instance = aobjects.Instance(self, content["instance"])
169187

170188
await self.on_friend_location(user, world, location, instance)
171189

0 commit comments

Comments
 (0)