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

Conversation

jacobq
Copy link

@jacobq jacobq commented Jun 27, 2018

  • In drawData
  • In supplyDefaultsUpdateCalc

@jacobq jacobq force-pushed the fix-draw-data-exception branch from b1164e7 to 51861ee Compare June 27, 2018 15:37
* In drawData
* In supplyDefaultsUpdateCalc
@jacobq jacobq force-pushed the fix-draw-data-exception branch from 51861ee to d8925f7 Compare June 27, 2018 15:39
@jacobq
Copy link
Author

jacobq commented Jun 27, 2018

OK, I think this is ready for review (I'm done doing git push -f here ;))

@etpinard
Copy link
Contributor

etpinard commented Jun 27, 2018

Thanks very much for the PR!

I tested out https://codepen.io/watashiku/pen/pKJJNW?editors=1010 (from #2687 (comment)) off your branch and your patch didn't appear to fix the issues reported, it only hides the console errors.

Moreover, your patch made a few of our tests fail.

I hope I'm wrong, but I think fixing the issues of #2687, #2643, and #2644 will have to wait a multi-week effort to implement #2644 (comment)

@@ -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 !

@jacobq
Copy link
Author

jacobq commented Jun 28, 2018

@etpinard Please check/re-run that latest CI build. It looks to me like the failures aren't being caused by the changes in this PR (got stuck on "install dependencies" step). I'm curious to see if the test failures you saw earlier were because of my typo (had accidentally put a ! in part of the sanity checking code, rendering it completely wrong).

You are right that this PR doesn't resolve the larger issue. It's just intended to prevent uncaught exceptions.

@etpinard
Copy link
Contributor

It's just intended to prevent uncaught exceptions.

... and that's why I'd vote 👎 on merging this patch.

@jacobq
Copy link
Author

jacobq commented Jun 28, 2018

If you don't want to merge it that's fine, but I don't understand how broken code is better than gracefully failing code. Of course it would be best not to have the errors at all, but if we're going to have them wouldn't it be better to handle them?

@etpinard
Copy link
Contributor

but I don't understand how broken code is better than gracefully failing code.

Because I don't think adding fallbacks to these broken things doesn't make plotly.js more graceful in my mind. I could be wrong though.

@jacobq jacobq closed this Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants