I have a crash in this extension method of `String`:

```
    func imageSize() -> CGSize {
//        self = "https://s3-eu-west-1.amazonaws.com/mimg.haraj.com.sa/userfiles30/2018-8-6/524x334-1_-E7VSb5T20mOouX.jpg"

        var width = 0
        var height = 0

        let split0 = self.split(separator: "/")
        if split0.count > 0 {
            let split1 = split0.last?.split(separator: "-")
            if (split1?.count)! > 0 {

                let split2 = split1?.first?.decomposedStringWithCanonicalMapping.split(separator: "x")

                width = (split2?.first?.decomposedStringWithCanonicalMapping.toInt())!

                if (split2?.count)! > 1 {
//                    let split2 = split1![1].decomposedStringWithCanonicalMapping.split(separator: "-")
                    height = (split2?.last?.decomposedStringWithCanonicalMapping.toInt())!
                }
            }
        }

        return CGSize(width: width, height: height)
    }

```

The crash is on line `return CGSize(width: width, height: height)`

I have created an `NSString` version like this to use the same above method:

```
@objc extension NSString {
    func imageSize1() -> CGSize {
        return (self as String).imageSize()
    }
}

```

This is then called from obj-c code:

```
CGSize imageSize = [url imageSize1];

```

Examples of url are:

<https://s3-eu-west-1.amazonaws.com/mimg.haraj.com.sa/userfiles30/2019-02-07/675x900-1_-CdC62Y2hcV7208.jpg>

<https://s3-eu-west-1.amazonaws.com/mimg.haraj.com.sa/userfiles30/2019-02-07/675x900-1_-697e3no8ec2E1I.jpg>

<https://s3-eu-west-1.amazonaws.com/mimg.haraj.com.sa/userfiles30/2019-02-07/675x900-1_-8Af5D20wh9b62z.jpg>

What this `imageSize()` method does is that it parses the image size from the url. The urls above contain the sizes 675x900 -> widthxheight.

In rare case we encounter a url where there is no information of the size and the url is not in the format above. So if the size is not found `CGSize = (0 , 0)` is returned.

I have tested this method on all expected scenarios.
But due to some reasons the method is causing crashes. May be I missed/messed something.

Here is the link to Crashlytics [issue](http://crashes.to/s/def0dae1fb5).

Any help would be appreciated.