api: Fix operator precedence

Problem:
  - commit 94a6f16cf121b29be8bf8a881a6465bbb07c5f73 introduced an error
    regarding operator precedence in two if clauses resulting in broken
    program logic.

Solution:
  - Use parantheses to tell the compiler the desired precedence.