I also experienced the same fault immediately after my Kunena 5.1 update.
I substituted the two files mentioned on these two pages.
The problem was corrected.
I noticed that both previous posts were closed. For others that might run into this problem..... I thought a repeat post might help.