fix Out of Code detetction indexerror

This commit is contained in:
Meng Zhuo 2013-06-19 18:12:12 +08:00
parent d41ca9e656
commit 1c80d84e9c

View File

@ -99,7 +99,7 @@ def find_all_code_type(path):
types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read()) types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', source.read())
try: try:
popular_type = Counter(types).most_common()[0][0] popular_type = Counter(types).most_common()[0][0]
except KeyError: except IndexError:
popular_type = "lua" # Don't break default popular_type = "lua" # Don't break default
return popular_type return popular_type