changeset 1425:13e126941bdd

The scribbo may set the duplicated-src to itself. We work around it here. However, we should modify the scribbo to fix it.
author wycc
date Sat, 09 Apr 2011 03:41:03 +0800
parents bd3d5ac8e748
children 5487aaf6f863
files nodejs/svg.js
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/svg.js	Sat Apr 09 03:39:57 2011 +0800
+++ b/nodejs/svg.js	Sat Apr 09 03:41:03 2011 +0800
@@ -976,16 +976,15 @@
     attr = n.attr('duplicate-src');
     if (attr) {
         var id = attr.value();
-        var orign = this.mb_rt.mbnames[id].node;
-        sys.puts("xxxxxxxxxxxxxx");
-        var nw = getInteger(orign,'width');
-        var nh = getInteger(orign,'height');
-	sys.puts("nw="+nw);
-	sys.puts("nh="+nh);
-	sys.puts("w="+w);
-	sys.puts("h="+h);
-	tcoord.sx *= w/nw;
-	tcoord.sy *= h/nh;
+        var src = this.mb_rt.mbnames[id];
+	if (src != null) {
+            var orign = src.node;
+            sys.puts("xxxxxxxxxxxxxx");
+            var nw = getInteger(orign,'width');
+            var nh = getInteger(orign,'height');
+	    tcoord.sx *= w/nw;
+	    tcoord.sy *= h/nh;
+	}
     }