Skip to content

NSRangeException #816

Description

@manuelkiessling

Environment:

  • React Native 0.3.11
  • Xcode 6.2
  • iOS Simulator iPhone 6

Running this app:

/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
TextInput,
View,
} = React;
var HelloWorld = React.createClass({
getInitialState: function() {
return {
name: 'World'
};
},
onNameChanged: function(event) {
this.setState({ name: event.nativeEvent.text });
},
render: function() {
return (
<View style={styles.container}>
<TextInput
style={styles.nameInput}
onChange={this.onNameChanged}
placeholder='Who should be greeted?'/>
<Text style={styles.welcome}>
Hello, {this.state.name}!</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+Control+Z for dev menu
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
nameInput: {
height: 36,
padding: 4,
margin: 24,
fontSize: 18,
borderWidth: 1,
}
});
AppRegistry.registerComponent('HelloWorld', () => HelloWorld);

and then entering several dozen characters into the text input field results in

2015-04-11 21:53:26.041 [tid:com.facebook.React.JavaScript] "Running application "HelloWorld" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
2015-04-11 21:53:33.810 HelloWorld[16130:3112472] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** NSRunStorage, _NSBlockNumberForIndex(): index (0) beyond array bounds (0)'
*** First throw call stack:
(
0 CoreFoundation 0x000000010421fc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000103691bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010421fb9d +[NSException raise:format:] + 205
3 UIFoundation 0x000000010c2c7adb _NSBlockNumberForIndex + 84
4 UIFoundation 0x000000010c2b8641 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 364
5 UIFoundation 0x000000010c2ba6aa -[NSLayoutManager glyphRangeForTextContainer:] + 317
6 HelloWorld 0x0000000102da5eb8 -[RCTText drawRect:] + 152
7 UIKit 0x0000000105d00612 -[UIView(CALayerDelegate) drawLayer:inContext:] + 495
8 QuartzCore 0x00000001059c0a1a -[CALayer drawInContext:] + 119
9 QuartzCore 0x00000001058ba93b CABackingStoreUpdate_ + 2793
10 QuartzCore 0x00000001059c0923 ___ZN2CA5Layer8display_Ev_block_invoke + 59
11 QuartzCore 0x00000001059c07ae _ZN2CA5Layer8display_Ev + 1478
12 QuartzCore 0x00000001059b54c9 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 301
13 QuartzCore 0x00000001059b5551 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35
14 QuartzCore 0x0000000105921886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
15 QuartzCore 0x0000000105922a3a _ZN2CA11Transaction6commitEv + 462
16 QuartzCore 0x00000001059230eb _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
17 CoreFoundation 0x0000000104152ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
18 CoreFoundation 0x0000000104152c00 __CFRunLoopDoObservers + 368
19 CoreFoundation 0x0000000104148a33 __CFRunLoopRun + 1123
20 CoreFoundation 0x0000000104148366 CFRunLoopRunSpecific + 470
21 GraphicsServices 0x0000000107b9aa3e GSEventRunModal + 161
22 UIKit 0x0000000105c80900 UIApplicationMain + 1282
23 HelloWorld 0x0000000102ceba6f main + 111
24 libdyld.dylib 0x0000000107197145 start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) fe

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions