mirror of https://github.com/sbt/sbt.git
Fix scripted parser crash
In a local progress, I was able to induce a crash in tab completions because the group key did not exist in pairMap.
This commit is contained in:
parent
11bc90c481
commit
9dff18d736
|
|
@ -144,7 +144,7 @@ object ScriptedPlugin extends AutoPlugin {
|
||||||
|
|
||||||
// Grabs the filenames from a given test group in the current page definition.
|
// Grabs the filenames from a given test group in the current page definition.
|
||||||
def pagedFilenames(group: String, page: ScriptedTestPage): Seq[String] = {
|
def pagedFilenames(group: String, page: ScriptedTestPage): Seq[String] = {
|
||||||
val files = pairMap(group).toSeq.sortBy(_.toLowerCase)
|
val files = pairMap.get(group).toSeq.flatten.sortBy(_.toLowerCase)
|
||||||
val pageSize = files.size / page.total
|
val pageSize = files.size / page.total
|
||||||
// The last page may loose some values, so we explicitly keep them
|
// The last page may loose some values, so we explicitly keep them
|
||||||
val dropped = files.drop(pageSize * (page.page - 1))
|
val dropped = files.drop(pageSize * (page.page - 1))
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ object Scripted {
|
||||||
|
|
||||||
// Grabs the filenames from a given test group in the current page definition.
|
// Grabs the filenames from a given test group in the current page definition.
|
||||||
def pagedFilenames(group: String, page: ScriptedTestPage): Seq[String] = {
|
def pagedFilenames(group: String, page: ScriptedTestPage): Seq[String] = {
|
||||||
val files = pairMap(group).toSeq.sortBy(_.toLowerCase)
|
val files = pairMap.get(group).toSeq.flatten.sortBy(_.toLowerCase)
|
||||||
val pageSize = if (page.total == 0) files.size else files.size / page.total
|
val pageSize = if (page.total == 0) files.size else files.size / page.total
|
||||||
// The last page may loose some values, so we explicitly keep them
|
// The last page may loose some values, so we explicitly keep them
|
||||||
val dropped = files.drop(pageSize * (page.page - 1))
|
val dropped = files.drop(pageSize * (page.page - 1))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue