Skip to content

[firebase_crashlytics] RangeError: Value not in range: -1 #32178

@matthewlloyd

Description

@matthewlloyd

I'm seeing a RangeError exception at https://github.com/flutter/plugins/blob/f254cd2573db895d927abeff1e2b7a1dfb177b1b/packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart#L189

  List<Map<String, String>> _getStackTraceElements(List<String> lines) {
    final List<Map<String, String>> elements = <Map<String, String>>[];
    for (String line in lines) {
      final List<String> lineParts = line.split(RegExp('\\s+'));
      try {
        final String fileName = lineParts[0];
        final String lineNumber =
            lineParts[1].substring(0, lineParts[1].indexOf(":")).trim();
        final String className =
            lineParts[2].substring(0, lineParts[2].indexOf(".")).trim();
        final String methodName =
            lineParts[2].substring(lineParts[2].indexOf(".") + 1).trim();

line is set to "package:flutter/src/foundation/assertions.dart 519:9 new FlutterError.fromParts.<fn>" and the className line throws an exception because lineParts[2] is new which doesn't contain a ..

I would add more information but this bug seems pretty self-explanatory :)

The bug was introduced by the new code in flutter/plugins#1080

@kroikie @collinjackson Could you guys take a look?

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolep: firebaseFirebase pluginsp: firebase_crashlyticsThe Firebase Crashlytics pluginpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions