Exceptions for Android Samsung


#1

Hello,

I run my application on different devices and found that Samsung Galaxy 3 /4 has following Exceptions:

Exception:

  06-02 14:16:20.166: D/CordovaLog(2849): file:///android_asset/www/lib/js/ionic/1.0.0-beta.6-ionic.bundle.js: Line 6066 : Uncaught TypeError: Cannot read property 'width' of null

On Nexus 4 I don’t see these errors

From Ionic Bundle:

align: function(align) {

      align || (align = this.alignTitle);

      // Find the titleEl element
      var titleEl = this.el.querySelector('.title');
      if(!titleEl) {
        return;
      }

      var self = this;
      //We have to rAF here so all of the elements have time to initialize
      ionic.requestAnimationFrame(function() {
        var i, c, childSize;
        var childNodes = self.el.childNodes;
        var leftWidth = 0;
        var rightWidth = 0;
        var isCountingRightWidth = false;

        // Compute how wide the left children are
        // Skip all titles (there may still be two titles, one leaving the dom)
        // Once we encounter a titleEl, realize we are now counting the right-buttons, not left
        for(i = 0; i < childNodes.length; i++) {
          c = childNodes[i];
          if (c.tagName && c.tagName.toLowerCase() == 'h1') {
            isCountingRightWidth = true;
            continue;
          }

          childSize = null;
          if(c.nodeType == 3) {
            childSize = ionic.DomUtil.getTextBounds(c).width; // <-------- here drops Exception
          } else if(c.nodeType == 1) {
            childSize = c.offsetWidth;
          }
          if(childSize) {
            if (isCountingRightWidth) {
              rightWidth += childSize;
            } else {
              leftWidth += childSize;
            }
          }
        }

Thanks,


#2

I too got this issue. On this thread

@adam said it is fixed in the nightly build


#3

The fix is in beta8 now. Please let us know if you encounter any other issues and thank you for helping to debug it.


#5

Tested on S3/4 1.0.0-beta.8. Fixed