Check for empty flags list

IndexErrors are not fun.