Critical points of non-smooth functions with a weak compactness condition