{"action":"created","issue":{"url":"https://api.github.com/repos/mirego/MRGArchitect/issues/17","repository_url":"https://api.github.com/repos/mirego/MRGArchitect","labels_url":"https://api.github.com/repos/mirego/MRGArchitect/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/mirego/MRGArchitect/issues/17/comments","events_url":"https://api.github.com/repos/mirego/MRGArchitect/issues/17/events","html_url":"https://github.com/mirego/MRGArchitect/pull/17","id":376967108,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MDU4NzI2","number":17,"title":"Fix a possible crash with pathForClassName","user":{"login":"pmartel12","id":8106782,"node_id":"MDQ6VXNlcjgxMDY3ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/8106782?v=4","gravatar_id":"","url":"https://api.github.com/users/pmartel12","html_url":"https://github.com/pmartel12","followers_url":"https://api.github.com/users/pmartel12/followers","following_url":"https://api.github.com/users/pmartel12/following{/other_user}","gists_url":"https://api.github.com/users/pmartel12/gists{/gist_id}","starred_url":"https://api.github.com/users/pmartel12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmartel12/subscriptions","organizations_url":"https://api.github.com/users/pmartel12/orgs","repos_url":"https://api.github.com/users/pmartel12/repos","events_url":"https://api.github.com/users/pmartel12/events{/privacy}","received_events_url":"https://api.github.com/users/pmartel12/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-02T21:04:01Z","updated_at":"2018-11-02T21:15:58Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/mirego/MRGArchitect/pulls/17","html_url":"https://github.com/mirego/MRGArchitect/pull/17","diff_url":"https://github.com/mirego/MRGArchitect/pull/17.diff","patch_url":"https://github.com/mirego/MRGArchitect/pull/17.patch"},"body":"## 📖 Description\r\n\r\nModification to avoid a possible crash with the method \"- (NSString *)pathForClassName:(NSString *)className suffix:(NSString *)suffix\".\r\n\r\n## ⚠️ Problem\r\n\r\nIn some Swift project build with Xcode 10, a crash can occur when MRGArchitect is initialized with the `MRGArchitect(for: )` method. \r\n\r\nThe crash looks like this:\r\n\r\n```\r\n(lldb) po [NSBundle bundleForClass:(NSString *)NSClassFromString(className)]\r\nerror: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x20).\r\nThe process has been returned to the state before expression evaluation.\r\n```\r\n\r\n## 🔎 Causes\r\n\r\nSometimes, the call to `NSClassFromString` can returns `nil`.\r\n\r\nWith code generated with XCode 10, `NSBundle bundleForClass` crashes when the `class` parameter is `nil`.\r\n\r\nWith code generated with Xcode 9, `NSBundle bundleForClass` returns the `.app` folder when the `class` parameter is `nil`.\r\n\r\n## 🤓 Solution\r\n\r\nI replaced `NSBundle bundleForClass` with `NSBundle pathForResource` to fix the crash."},"comment":{"url":"https://api.github.com/repos/mirego/MRGArchitect/issues/comments/435511509","html_url":"https://github.com/mirego/MRGArchitect/pull/17#issuecomment-435511509","issue_url":"https://api.github.com/repos/mirego/MRGArchitect/issues/17","id":435511509,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTUxMTUwOQ==","user":{"login":"jcouture","id":5007,"node_id":"MDQ6VXNlcjUwMDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5007?v=4","gravatar_id":"","url":"https://api.github.com/users/jcouture","html_url":"https://github.com/jcouture","followers_url":"https://api.github.com/users/jcouture/followers","following_url":"https://api.github.com/users/jcouture/following{/other_user}","gists_url":"https://api.github.com/users/jcouture/gists{/gist_id}","starred_url":"https://api.github.com/users/jcouture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcouture/subscriptions","organizations_url":"https://api.github.com/users/jcouture/orgs","repos_url":"https://api.github.com/users/jcouture/repos","events_url":"https://api.github.com/users/jcouture/events{/privacy}","received_events_url":"https://api.github.com/users/jcouture/received_events","type":"User","site_admin":false},"created_at":"2018-11-02T21:15:58Z","updated_at":"2018-11-02T21:15:58Z","author_association":"MEMBER","body":"@flambert I honestly do not remember. That’s possible but I’m not sure. :("}}
{"actor":{"display_login":"jcouture"}}