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

Commit 30cec30

Browse files
committed
Fix when dequeue is null
1 parent 074f746 commit 30cec30

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/EventHook/ApplicationWatcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ private async Task AppConsumer()
185185
{
186186
//blocking here until a key is added to the queue
187187
var item = await appQueue.DequeueAsync();
188+
189+
if(item is null)
190+
{
191+
continue;
192+
}
193+
188194
if (item is bool)
189195
{
190196
break;

src/EventHook/ClipboardWatcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ private async Task ClipConsumerAsync()
132132
while (isRunning)
133133
{
134134
var item = await clipQueue.DequeueAsync();
135+
136+
if (item is null)
137+
{
138+
continue;
139+
}
140+
135141
if (item is bool)
136142
{
137143
break;

src/EventHook/KeyboardWatcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ private async Task ConsumeKeyAsync()
144144
{
145145
//blocking here until a key is added to the queue
146146
var item = await keyQueue.DequeueAsync();
147+
148+
if (item is null)
149+
{
150+
continue;
151+
}
152+
147153
if (item is bool)
148154
{
149155
break;

src/EventHook/MouseWatcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ private async Task ConsumeKeyAsync()
120120
{
121121
//blocking here until a key is added to the queue
122122
var item = await mouseQueue.DequeueAsync();
123+
124+
if (item is null)
125+
{
126+
continue;
127+
}
128+
123129
if (item is bool)
124130
{
125131
break;

0 commit comments

Comments
 (0)