Skip to content

Commit

Permalink
Move a Fiber.getThis() out of a while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
zorael committed Feb 16, 2025
1 parent ddeb46f commit 847b7af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/kameloso/plugins/common/mixins/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ mixin template WHOISFiberDelegate(
import std.traits : arity;
import core.thread.fiber : Fiber;

auto thisFiber = cast(CarryingFiber!IRCEvent)Fiber.getThis();
assert(thisFiber, "Incorrectly cast fiber: " ~ typeof(thisFiber).stringof);

while (true)
{
auto thisFiber = cast(CarryingFiber!IRCEvent)Fiber.getThis();
assert(thisFiber, "Incorrectly cast fiber: " ~ typeof(thisFiber).stringof);
assert((thisFiber.payload != IRCEvent.init),
"Uninitialised `payload` in " ~ typeof(thisFiber).stringof);

Expand Down

0 comments on commit 847b7af

Please sign in to comment.