No announcement yet.
  • Filter
  • Time
Clear All
new posts

  • [BUG] Method isc.StretchImg.inWhichPart() throws error when item is undefined.

    Hi, Isomorphic,

    We've logged one strange error in browser and find out that sc.StretchImg.inWhichPart() don't check undefined conditions in:

    inWhichPart : function () {
        if (this.vertical) {
            var num = this.inWhichPosition(this._imgSizes, this.getOffsetY());
        } else {
            var direction = (this.ignoreRTL || !this.isRTL()) ? isc.Canvas.LTR : isc.Canvas.RTL;
            var num = this.inWhichPosition(this._imgSizes, this.getOffsetX(), direction);
        var item = this.items[num];
        // If the TabSet includes an "emptyButton" between the ScrollerForwardImg and the
        // ScrollerBackImg we need to take it into account, as the emptyButton is not a valid
        // target for inWhichPart(). So, if the cursor is in the emptyButton, we will return the
        // next item in the scroller, that will be the ScrollerBackImg.
        if ( == "emptyButton") item = this.items[num+1]; // <- HERE  if item is undefined then exception is thrown during property access "name" on undefined.
        return (item ? : null); // <- HERE seems checking is done after property access should be done before.
    Tested on SmartClient 10.1p 2019-02-13 (version) older also affected.

  • #2
    This is an undocumented API and it's not clear that there's a valid usage in which a null check would be required, however, we've gone ahead and added such a check just in case.

    Isomorphic Software


    • #3
      But, we are not using this API directly, we've got exception from Scroolbar.handleMouseMove() in when mouse overs somehow unintentionally, unfortunately hasn't reporoduced this in dev env.