--- a/client/js/paper-renderer.js Tue May 14 12:36:11 2013 +0200
+++ b/client/js/paper-renderer.js Tue May 14 12:54:42 2013 +0200
@@ -627,16 +627,14 @@
};
Rkns.Renderer.Edge.prototype.redraw = function() {
- this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from"));
- this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to"));
- if (!this.from_representation || !this.to_representation) {
-/*
- console.log(
- "Error on edge " + this.model.get("id")
- + " from " + (this.model.get("from") ? this.model.get("from").get("id") : "<null>")
- + " to " + (this.model.get("to") ? this.model.get("to").get("id") : "<null>")
- );
-*/
+ var from = this.model.get("from"),
+ to = this.model.get("to");
+ if (!from || !to) {
+ return;
+ }
+ this.from_representation = this.renderer.getRepresentationByModel(from);
+ this.to_representation = this.renderer.getRepresentationByModel(to);
+ if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") {
return;
}
var _p0a = this.from_representation.paper_coords,
@@ -2208,6 +2206,9 @@
};
Rkns.Renderer.Scene.prototype.getRepresentationByModel = function(_model) {
+ if (!_model) {
+ return undefined;
+ }
return Rkns._(this.representations).find(function(_repr) {
return _repr.model === _model;
});