Skip to content

Commit

Permalink
Merge pull request #185 from bart-d/clientport
Browse files Browse the repository at this point in the history
bugfix: server crash when resizing canvas
  • Loading branch information
bart-d authored Apr 11, 2021
2 parents 99f8219 + dea3706 commit 9e136cf
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/libtextmode/textmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,15 @@ class Textmode {
}

function resize_canvas(doc, columns, rows) {
const {send} = require("../senders");
var client = false;
try {
const electron = require("electron");
const win = electron.remote.getCurrentWindow();
client = true;
} catch (err) {
console.log(err);
}
console.log('client: ' + client);
const min_rows = Math.min(doc.rows, rows);
const min_columns = Math.min(doc.columns, columns);
const new_data = new Array(columns * rows);
Expand All @@ -231,8 +239,11 @@ function resize_canvas(doc, columns, rows) {
doc.data = new_data;
doc.columns = columns;
doc.rows = rows;
$("drawing_grid").classList.add("hidden");
send("uncheck_all_guides");
if (client) {
const {send} = require("../senders");
$("drawing_grid").classList.add("hidden");
send("uncheck_all_guides");
}
}

module.exports = {bytes_to_blocks, bytes_to_utf8, current_date, Textmode, add_sauce_for_ans, add_sauce_for_bin, add_sauce_for_xbin, resize_canvas};

0 comments on commit 9e136cf

Please sign in to comment.