Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loops #2531

Merged
merged 3 commits into from Jan 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion iina/FileGroup.swift
Expand Up @@ -108,7 +108,8 @@ class FileGroup {
var i = prefix.count

while tempGroup.count < 2 {
var lastPrefix = ""
var lastPrefix = prefix
var anyProcessed = false
for finfo in contents {
// if reached string end
if i >= finfo.characters.count {
Expand All @@ -125,6 +126,7 @@ class FileGroup {
currChars.append((c, p))
}
tempGroup[p]!.append(finfo)
anyProcessed = true
}
// if all items have the same prefix
if tempGroup.count == 1 {
Expand All @@ -133,6 +135,10 @@ class FileGroup {
currChars.removeAll()
}
i += 1
// if all items have the same name
if !anyProcessed {
break
}
}

let maxSubGroupCount = tempGroup.reduce(0, { max($0, $1.value.count) })
Expand Down