The function does not return any language when the current language has not been set yet.
The current language is set very soon ('plugins_loaded' action) when the language is set from url but quite late ('wp' action) when it is set from content.
However, you may not need to bother with all the cases as Polylang fires the action 'pll_language_defined' when the current language is set.