Skip to content

Commit 3a49d4d

Browse files
committed
fix crash simpler way
1 parent 2b262a1 commit 3a49d4d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"make": "pnpm run build",
77
"make-dev": "pnpm run build-dev",
88
"build": "./workspaces.py install && ./workspaces.py build && pnpm python-api",
9+
"tsc-all": "./workspaces.py tsc --parallel",
910
"build-dev": "./workspaces.py install && ./workspaces.py build --dev && pnpm python-api",
1011
"clean": "rm -rf packages/node_modules && ./workspaces.py clean && cd compute/compute && pnpm clean ",
1112
"hub": "cd packages/hub && npm run hub-project-dev-nobuild",

src/packages/jupyter/util/cell-utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ export function new_cell_pos(
113113
Returned undefined whenever don't really know what to do; then caller
114114
just makes up a pos, and it'll get sorted out.
115115
*/
116+
if (cells == null) {
117+
return 0;
118+
}
116119
let cell_list_0: List<string>;
117120
if (cell_list == null) {
118121
cell_list_0 = sorted_cell_list(cells)!;
@@ -129,8 +132,8 @@ export function new_cell_pos(
129132
return false; // break iteration
130133
}
131134
});
132-
const adjacent_pos = cells?.getIn([adjacent_id, "pos"]) as number | undefined;
133-
const current_pos = (cells?.getIn([cur_id, "pos"]) ?? 0) as number;
135+
const adjacent_pos = cells.getIn([adjacent_id, "pos"]) as number | undefined;
136+
const current_pos = cells.getIn([cur_id, "pos"]) as number;
134137
let pos: number;
135138
if (adjacent_pos != null) {
136139
// there is a cell after (or before) cur_id cell

0 commit comments

Comments
 (0)