Fix broken null check

This commit is contained in:
2024-04-25 11:15:24 +02:00
parent 7e2ab13400
commit c8f3f8222f

View File

@@ -36,7 +36,7 @@ let update_stats = async id => {
}
const send_watch_command = () => {
if (socket.readyState === WebSocket.OPEN) {
if (socket !== null && socket.readyState === WebSocket.OPEN) {
socket.send(
JSON.stringify(
{cmd: "watch_file", a1: file.id, a2: view_token}
@@ -46,7 +46,7 @@ const send_watch_command = () => {
}
const init_socket = () => {
if (socket !== null || socket.readyState !== WebSocket.CLOSED) {
if (socket !== null && socket.readyState !== WebSocket.CLOSED) {
return
}