Skip to content

[share_plus] crashes on iOS when a share text starts with https:// #531

@justacid

Description

@justacid

The recently added URL detection on iOS crashes if a share text starts with https:// followed by some other text. Presumably because the NSURL object is nil if an invalid url is encountered. This was introduced with commit 4ede365.

System info

Issue occurs on: iOS
Plugin name: share_plus
Plugin version: 2.1.5+

Steps to Reproduce

Simply call share with an url followed by some other text.

Share.share('https://pub.dev SOMETHING');

Logs

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x18128805c 0x1997a2f54 0x181391538 0x18138ec5c 0x1812100f8 0x18123c164 0x1044fe4cc 0x1044fdd6c 0x106f59898 0x106aa5fa0 0x106db1690 0x106d5643c 0x106d59a34 0x18129d278 0x181221c50 0x18121c44c 0x1811fac68 0x18120e3c8 0x19ca1f38c 0x183bb40bc 0x183931be8 0x102511bcc 0x103885a24)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001b7cd89c4 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1b7cd89c4 <+8>:  b.lo   0x1b7cd89e4               ; <+40>
    0x1b7cd89c8 <+12>: pacibsp 
    0x1b7cd89cc <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b7cd89d0 <+20>: mov    x29, sp

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions