{"action":"created","issue":{"url":"https://api.github.com/repos/Jeavon/Slimsy/issues/5","repository_url":"https://api.github.com/repos/Jeavon/Slimsy","labels_url":"https://api.github.com/repos/Jeavon/Slimsy/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/Jeavon/Slimsy/issues/5/comments","events_url":"https://api.github.com/repos/Jeavon/Slimsy/issues/5/events","html_url":"https://github.com/Jeavon/Slimsy/issues/5","id":280138959,"number":5,"title":"GetSrcSetUrls throwing exception if images width is less than WidthStep","user":{"login":"mattbrailsford","id":527305,"avatar_url":"https://avatars1.githubusercontent.com/u/527305?v=4","gravatar_id":"","url":"https://api.github.com/users/mattbrailsford","html_url":"https://github.com/mattbrailsford","followers_url":"https://api.github.com/users/mattbrailsford/followers","following_url":"https://api.github.com/users/mattbrailsford/following{/other_user}","gists_url":"https://api.github.com/users/mattbrailsford/gists{/gist_id}","starred_url":"https://api.github.com/users/mattbrailsford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattbrailsford/subscriptions","organizations_url":"https://api.github.com/users/mattbrailsford/orgs","repos_url":"https://api.github.com/users/mattbrailsford/repos","events_url":"https://api.github.com/users/mattbrailsford/events{/privacy}","received_events_url":"https://api.github.com/users/mattbrailsford/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-12-07T13:57:24Z","updated_at":"2017-12-07T14:21:06Z","closed_at":null,"author_association":"NONE","body":"When calling GetSrcSetUrls with a width / height greater than the provided images width / height you get an axception\r\n\r\n````\r\nLength cannot be less than zero.\r\nParameter name: length\r\n\r\nat System.String.Substring(Int32 startIndex, Int32 length)\r\n   at Slimsy.Slimsy.GetSrcSetUrls(UrlHelper urlHelper, IPublishedContent publishedContent, Int32 width, Int32 height, Nullable`1 imageCropMode, String outputFormat)\r\n   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()\r\n   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()\r\n   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)\r\n   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)\r\n   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)\r\n   at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)\r\n   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)````\r\n\r\nFrom what I can tell it's because you do a substring in the return statement that always assumes the string builder contains something, which if your size is bigger than the max width (ie, your image natural width) then it doesn't and so throws and index error as your requested substring will be a length of -1."},"comment":{"url":"https://api.github.com/repos/Jeavon/Slimsy/issues/comments/349980524","html_url":"https://github.com/Jeavon/Slimsy/issues/5#issuecomment-349980524","issue_url":"https://api.github.com/repos/Jeavon/Slimsy/issues/5","id":349980524,"user":{"login":"Jeavon","id":1829920,"avatar_url":"https://avatars2.githubusercontent.com/u/1829920?v=4","gravatar_id":"","url":"https://api.github.com/users/Jeavon","html_url":"https://github.com/Jeavon","followers_url":"https://api.github.com/users/Jeavon/followers","following_url":"https://api.github.com/users/Jeavon/following{/other_user}","gists_url":"https://api.github.com/users/Jeavon/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeavon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeavon/subscriptions","organizations_url":"https://api.github.com/users/Jeavon/orgs","repos_url":"https://api.github.com/users/Jeavon/repos","events_url":"https://api.github.com/users/Jeavon/events{/privacy}","received_events_url":"https://api.github.com/users/Jeavon/received_events","type":"User","site_admin":false},"created_at":"2017-12-07T14:21:06Z","updated_at":"2017-12-07T14:21:06Z","author_association":"OWNER","body":"p.s. love the new avatar"}}
{"actor":{"display_login":"Jeavon"}}