Don't initialize observers when the watched property is not known DeepWatch
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 02 Aug 2014 06:45:55 +0200
branchDeepWatch
changeset 784d41ae224c5d2
parent 783 991345150b99
child 785 929f1192819c
Don't initialize observers when the watched property is not known
json/src/main/java/org/apidesign/html/json/spi/Observers.java
     1.1 --- a/json/src/main/java/org/apidesign/html/json/spi/Observers.java	Sat Aug 02 06:41:59 2014 +0200
     1.2 +++ b/json/src/main/java/org/apidesign/html/json/spi/Observers.java	Sat Aug 02 06:45:55 2014 +0200
     1.3 @@ -97,10 +97,12 @@
     1.4              if (w.proto != p) {
     1.5                  throw new IllegalStateException("Inconsistency: " + w.proto + " != " + p);
     1.6              }
     1.7 -            if (mine == null) {
     1.8 -                mine = new Observers();
     1.9 +            if (w.prop != null) {
    1.10 +                if (mine == null) {
    1.11 +                    mine = new Observers();
    1.12 +                }
    1.13 +                mine.add(w);
    1.14              }
    1.15 -            mine.add(w);
    1.16              return mine;
    1.17          }
    1.18      }