ionic-framework: VirtualScroll Can't read property length of null
Ionic version: (check one with “x”) [ ] 1.x [ ] 2.x [x] 3.x
I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: I got Null exception at https://github.com/driftyco/ionic/blob/master/src/components/virtual-scroll/virtual-scroll.ts#L601
Expected behavior: Check for null before calling length function
Steps to reproduce:
Don’t know how to reproduce. Got it only a few times.
Related code:
insert any relevant code here
Other information:
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.6
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.3.0
Xcode version: Xcode 8.3.2 Build version 8E2002
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 23 (7 by maintainers)
Getting this issue too. Tried this:
same here. I get:
after I updated from 2.2.0 to 3.3.0
@manucorporat I believe the source of this particular bug is a race condition between requestAnimationFrame and ngOnDestroy.
ngOnDestroy nulls out _nodes, _cells, _date, etc. at https://github.com/ionic-team/ionic/blob/master/src/components/virtual-scroll/virtual-scroll.ts#L819 but there are scheduled raf calls in renderVirtual and in _dom.read() / _dom.write() which might execute after ngOnDestroy has free’d those object properties.
Happened few times only. Don’t know how to reproduce. Closing this as there are other important issues than this one.