Skip to content

Commit cf7e9ee

Browse files
committed
refactor(server): Fix dead branch in addCustomMiddleware
The early-return check `!projectCustomMiddleware.length === 0` parses as `(!length) === 0`, which is always false for both empty and non-empty arrays. The branch never fired, but the for-loop below already handles empty arrays as a no-op, so behavior was unchanged. Initially found by @EdrilanBerisha in #1391
1 parent 4f5fd1b commit cf7e9ee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/server/lib/middleware/MiddlewareManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class MiddlewareManager {
245245
async addCustomMiddleware() {
246246
const project = this.graph.getRoot();
247247
const projectCustomMiddleware = project.getCustomMiddleware();
248-
if (!projectCustomMiddleware.length === 0) {
248+
if (projectCustomMiddleware.length === 0) {
249249
return; // No custom middleware defined
250250
}
251251

0 commit comments

Comments
 (0)