バグ #1314
未完了twitter/:account/:verify_credentials へのリクエストでレスポンスがnilになってしまうことがある
説明
どういう条件で発生するのかよくわかりませんが、以下のように単純なnilチェックを入れておけばいいのではないかと思いました。
diff --git a/core/plugin/twitter/model/world.rb b/core/plugin/twitter/model/world.rb
index 6b6d6e6c..a8110a04 100644
--- a/core/plugin/twitter/model/world.rb
+++ b/core/plugin/twitter/model/world.rb
@@ -241,7 +241,7 @@ module Plugin::Twitter
end
def user_data_failed_crash!(res)
- if '400' == res.code
+ if res && '400' == res.code
chi_fatal_alert "起動に必要なデータをTwitterが返してくれませんでした。規制されてるんじゃないですかね。\n" +
"ニコ動とか見て、規制が解除されるまで適当に時間を潰してください。ヽ('ω')ノ三ヽ('ω')ノもうしわけねぇもうし
わけねぇ\n" +
"\n\n--\n\n" +
再現手順
twitterアカウントを認証した状態で3時間くらい使ったときに以下のログでクラッシュした。
notice: {MIKUTTER_DIR}/core/boot/delayer.rb:37:in `block in terminate': undefined method `code' for nil:NilClass
from {MIKUTTER_DIR}/core/plugin/twitter/model/world.rb:244:in `user_data_failed_crash!'
from {MIKUTTER_DIR}/core/plugin/twitter/model/world.rb:236:in `user_data_failed'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/chain/base.rb:18:in `activate'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:93:in `block (2 levels) in wait_and_activate'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:87:in `catch'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:87:in `block in wait_and_activate'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:86:in `catch'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:86:in `wait_and_activate'from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:76:in `block (2 levels) in fiber'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:75:in `loop'
from {MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/delayer-deferred-2.0.0/lib/delayer/deferred/worker.rb:75:in `block in fiber'
notice: {MIKUTTER_DIR}/core/boot/delayer.rb:40:in `block in terminate': /tmp/20190204-17041-15smzyu.svg
notice: {MIKUTTER_DIR}/core/serialthread.rb:47:in `force_exit!': all Serial Thread Group jobs canceled.
notice: ./mikutter.rb:83:in `boot!': boot! exited normally.
notice: ./mikutter.rb:117:in `<main>': mainloop exited normally.
表示するデータがありません