Skip to content

Commit 7b75633

Browse files
committed
Added valid placeholder image instead of force unwrapping URL string
1 parent b6ffc81 commit 7b75633

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/ImageViewerRemote/ImageViewerRemote.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class ImageLoader: ObservableObject {
311311
private var cancellable: AnyCancellable?
312312

313313
func getURLRequest(url: String) -> URLRequest {
314-
let url = URL(string: url)!
314+
let url = URL(string: url) ?? URL(string: "https://via.placeholder.com/150.png")!
315315
var request = URLRequest(url: url)
316316
request.httpMethod = "GET"
317317

0 commit comments

Comments
 (0)