[polari] userList: Fix warning during filtering
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] userList: Fix warning during filtering
- Date: Tue, 31 Mar 2015 17:26:55 +0000 (UTC)
commit c75e8c38d881d35c0ba3f0d2b99f4af9881c010b
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Mar 31 18:59:17 2015 +0200
userList: Fix warning during filtering
We compute the popover height by adding the heights of n rows from
the first visible one. However when filtering turns out no match,
we don't have a visible row to start from - use the row at index 0
in that case to avoid a warning.
src/userList.js | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index d81c3ad..6e03051 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -420,7 +420,11 @@ const UserList = new Lang.Class({
this._updateHeightId = Mainloop.idle_add(Lang.bind(this, function() {
let topRow = this._list.get_row_at_y(this.widget.vadjustment.value);
let membersShown = Math.min(this.numRows, MAX_USERS_SHOWN);
- let index = Math.min(topRow.get_index(), this.numRows - membersShown);
+ // topRow is unset when all rows are hidden due to filtering,
+ // base height on the first membersShown rows in that case
+ let index = 0;
+ if (topRow)
+ index = Math.min(topRow.get_index(), this.numRows - membersShown);
let height = 0;
for (let i = 0; i < membersShown; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]