Ranchero-Software / NetNewsWire

RSS reader for macOS and iOS.
https://netnewswire.com/
MIT License
8.43k stars 534 forks source link

Crash in `main` — "Invalid parameter not satisfying: numberOfValues > 0" #4248

Closed stuartbreckenridge closed 1 week ago

stuartbreckenridge commented 8 months ago

Crashing when creating placeholders. There's an underlying NSParameterAssert(numberOfValues > 0); in the rs_SQLValueListWithPlaceholders call.

func unreadCount(feedIDs: Set<String>, since: Date, database: FMDatabase) -> Int? {

    let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))! // <-- Thread 2: "Invalid parameter not satisfying: numberOfValues > 0"
    let sql = "select count(*) from articles natural join statuses where feedID in \(placeholders) and (datePublished > ? or (datePublished is null and dateArrived > ?)) and read=0;"

    var parameters = [Any]()
    parameters += Array(feedIDs) as [Any]
    parameters += [since] as [Any]
    parameters += [since] as [Any]

    let unreadCount = database.count(sql: sql, parameters: parameters, tableName: name)
    return unreadCount
}