summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-12-25 06:54:52 -0500
committeryenatch <yenatch@gmail.com>2013-12-25 06:54:52 -0500
commit020ae38d348d895ccdd36f9c2bdce4c22505d627 (patch)
treeb4b725e96ebb494af3bf3c4f481c9432fc1bf18f
parentd983b8a02ad046ee9a671f2a5b7c330b4084b8ec (diff)
wram: return an empty dict for missing constants files
-rw-r--r--pokemontools/wram.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pokemontools/wram.py b/pokemontools/wram.py
index 1029c8e..2133444 100644
--- a/pokemontools/wram.py
+++ b/pokemontools/wram.py
@@ -117,10 +117,10 @@ def read_constants(filepath):
"""
Load lines from a file and call scrape_constants.
"""
- lines = None
-
- with open(filepath, "r") as file_handler:
- lines = file_handler.readlines()
+ lines = []
+ if os.path.exists(filepath):
+ with open(filepath, "r") as file_handler:
+ lines = file_handler.readlines()
constants = scrape_constants(lines)
return constants