Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guards for unsafe dereferencing (ref #2687) #2757

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/plot_api/subroutines.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,18 @@ exports.drawData = function(gd) {
var i;

// remove old colorbars explicitly
for(i = 0; i < calcdata.length; i++) {
var trace = calcdata[i][0].trace;
if(trace.visible !== true || !trace._module.colorbar) {
fullLayout._infolayer.select('.cb' + trace.uid).remove();
if(calcdata && calcdata.length) {
for(i = 0; i < calcdata.length; i++) {
var trace = calcdata[i][0].trace;
if(trace.visible !== true || !trace._module.colorbar) {
fullLayout._infolayer.select('.cb' + trace.uid).remove();
}
}
}
else {
// Abort / reject
return Promise.reject('drawData aborting due to receiving invalid calcdata');
}

clearGlCanvases(gd);

Expand Down
2 changes: 1 addition & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ plots.supplyDefaults = function(gd, opts) {
plots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) {
for(var i = 0; i < newFullData.length; i++) {
var newTrace = newFullData[i];
var cd0 = oldCalcdata[i][0];
var cd0 = oldCalcdata && oldCalcdata[i] && !oldCalcdata[i][0];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eek, I just noticed a really bad typo here: there shouldn't be a !

if(cd0 && cd0.trace) {
var oldTrace = cd0.trace;
if(oldTrace._hasCalcTransform) {
Expand Down