Skip to content

Commit

Permalink
DrawAreaBase: Fix crash if scroll thumb maximized (JDimproved#1393)
Browse files Browse the repository at this point in the history
スレビューでレスの少ないスレを開きスクロールバーのノブがバー一杯に
広がると異常終了することががあったため修正します。
修正前は変数値の取りうる範囲を間違えていました。

修正にあたり不具合報告をしていただきありがとうございました。
https://next2ch.net/linux/1654053581/197
  • Loading branch information
ma8ma committed May 7, 2024
1 parent 60a7dad commit 507f4dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/article/drawareabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,8 @@ void DrawAreaBase::exec_scroll()
break;
}

const int y_new = static_cast<int>(std::clamp<double>( y, 0, adjust->get_upper() - adjust->get_page_size() ));
// (upper - page_size) と y はどちらもマイナス値になることがある
const int y_new = (std::max)( 0, (std::min)( static_cast<int>(adjust->get_upper() - adjust->get_page_size()), y ) );
if( current_y != y_new ){

m_cancel_change_adjust = true;
Expand Down

0 comments on commit 507f4dd

Please sign in to comment.