Skip to content

Commit e9bc2e6

Browse files
committed
[collapsible_headings] handle potential null cell value in callback
cell can be null if an attempt was made to extend selection beyond existing cells
1 parent 1266e17 commit e9bc2e6

File tree

1 file changed

+5
-0
lines changed
  • src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings

1 file changed

+5
-0
lines changed

src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@
179179
// Restrict the search to cells that are of the same level and lower
180180
// than the currently selected cell by index.
181181
var ref_cell = _get_cell_at_index(index);
182+
// ref_cell may be null, if we've attempted to extend selection beyond
183+
// the existing cells
184+
if (!ref_cell) {
185+
return;
186+
}
182187
var pivot_level = get_cell_level(ref_cell);
183188
var cells = _get_cells();
184189
while (index > 0 && pivot_level > 1) {

0 commit comments

Comments
 (0)