Don't crash the generator if api_names_out.yaml is absent (#746)

This commit is contained in:
Daniel Azuma authored and GitHub committed 2018-12-05 14:54:11 -08:00
1 parent b1942bdc3e
commit 5f4abfdfec
1 file changed
+2 -2
+2 -2
View File
@@ -42,13 +42,13 @@ module Google
include NameHelpers
def initialize(names_out_file_path = nil, names_file_path = nil)
if names_out_file_path
if names_out_file_path && File.file?(names_out_file_path)
logger.info { sprintf('Loading API names from %s', names_out_file_path) }
@names = YAML.load(File.read(names_out_file_path)) || {}
else
@names = {}
end
if names_file_path
if names_file_path && File.file?(names_file_path)
logger.info { sprintf('Loading API names from %s', names_file_path) }
@names = @names.merge(YAML.load(File.read(names_file_path)) || {})
end