Reverse order of visibility check and bad line / bad bezier checks in `CanvasRenderer.prototype.drawEdge()`, and add null check on `ele._private.rscratch.allpts`.
Reverse order of visibility check and bad line / bad bezier checks in `CanvasRenderer.prototype.drawEdge()`, and add null check on `ele._private.rscratch.allpts`.

The visibility check is a historical check, used before the texture caching.  It's useful as a sanity check now, but it makes sense to check it before renderer scratchpad data (calculated rendered style), as cases like image export may call `drawEdge()` indiscriminately.  The null check on `allpts` is inexpensive and generally good practice, even though `allpts != null` for all visible edges.

Ref : TypeError during export to png/jpg if some edges were never shown before #2096

cytoscape/cytoscape.js,cytoscape/cytoscape.js