• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Revisão29968bc75167d7fe325041225fe89b9adffea571 (tree)
Hora2013-11-24 12:05:52
AutorDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Mensagem de Log

* [shogi-server] - shogi_server/league/floodgate.rb: Improved robustness against empty file under ruby 1.9.3p194

Mudança Sumário

Diff

--- a/changelog
+++ b/changelog
@@ -1,3 +1,9 @@
1+2013-11-24 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * [shogi-server]
4+ - shogi_server/league/floodgate.rb: Improved robustness against
5+ empty file under ruby 1.9.3p194
6+
17 2013-11-23 Daigo Moriwaki <daigo at debian dot org>
28
39 * [mk_rate]
--- a/shogi_server/league/floodgate.rb
+++ b/shogi_server/league/floodgate.rb
@@ -216,8 +216,13 @@ class League
216216 def load
217217 return unless @file.exist?
218218
219- @records = YAML.load_file(@file)
220- unless @records && @records.instance_of?(Array)
219+ begin
220+ @records = YAML.load_file(@file)
221+ unless @records && @records.instance_of?(Array)
222+ $logger.error "%s is not a valid yaml file. Instead, an empty array will be used and updated." % [@file]
223+ @records = []
224+ end
225+ rescue
221226 $logger.error "%s is not a valid yaml file. Instead, an empty array will be used and updated." % [@file]
222227 @records = []
223228 end