Fix faulty assert that stops the program from working with inter frames.

- The assert would be true after the next if block, but in it's current place
  it's false.
Address clang-analyzer warning.

- Assert was in the wrong place.