fix undefined index error

#5696 

#### Changes

* Check first before trying to access language object from `langauge_list()` return value.