Don't throw error if unpaired while trying to get my processes

This commit is contained in:
Sosthene 2025-07-04 12:26:11 +02:00
parent 989263d44a
commit 189bd3d252
2 changed files with 7 additions and 1 deletions

View File

@ -147,7 +147,7 @@ export class Database {
const activeWorker = this.serviceWorkerRegistration?.active || (await this.waitForServiceWorkerActivation(this.serviceWorkerRegistration!)); const activeWorker = this.serviceWorkerRegistration?.active || (await this.waitForServiceWorkerActivation(this.serviceWorkerRegistration!));
const service = await Services.getInstance(); const service = await Services.getInstance();
const payload = await service.getMyProcesses(); const payload = await service.getMyProcesses();
if (payload!.length != 0) { if (payload && payload.length != 0) {
activeWorker?.postMessage({ type: 'SCAN', payload }); activeWorker?.postMessage({ type: 'SCAN', payload });
} }
}, 5000); }, 5000);

View File

@ -1340,6 +1340,12 @@ export default class Services {
} }
public async getMyProcesses(): Promise<string[] | null> { public async getMyProcesses(): Promise<string[] | null> {
// If we're not paired yet, just skip it
try {
this.getPairingProcessId();
} catch (e) {
return null;
}
try { try {
const processes = await this.getProcesses(); const processes = await this.getProcesses();