cc-tweaked / CC-Tweaked

Just another ComputerCraft fork
https://tweaked.cc
934 stars 211 forks source link

Incorrectly written if/else if in ComputerThread? #528

Closed ghost closed 4 years ago

ghost commented 4 years ago

Minecraft: 1.14.4 CC:T: 93a9ebc4f6b8c7c59151feffa1b5ab3996c016f5

Not a bug report per se; just found something sketchy in the code.

https://github.com/SquidDev-CC/CC-Tweaked/blob/mc-1.14.x/src/main/java/dan200/computercraft/core/computer/ComputerThread.java#L398

The else if clause here can never run because if afterHardAbort is >= ABORT_TIMEOUT * 2 then it must be >= ABORT_TIMEOUT, so the first if clause will always run, even if afterHardAbort is >= ABORT_TIMEOUT * 2.

SquidDev commented 4 years ago

Yeah, that looks stupid. Wonder how that slipped through.