What is wrong about this proof? (NP P; One Way Function)

I read a proof in my script:
If P != NP -> There exists no OWF.

Their proof was a bit messy so I want to ask if this also counts as a correct proof:

Assume P = NP, and a OWF over {0,1}^n. Then there exists a NTM M, that can check every possible String in {0,1}^n in O(n)-time (binary tree). Therefore, F^-1 is in NP.
If P = NP, then F^-1 is in P and there would not exist an OWF.