Skip to content

Commit

Permalink
attempt to fix NPE thrown by text area
Browse files Browse the repository at this point in the history
  • Loading branch information
SpoilerRules committed Mar 30, 2024
1 parent 68b67f6 commit 0225e28
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/com/spoiligaming/generator/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import java.net.URI

fun main(args: Array<String>) {
Logger.showDebug = "-debug" in args
if ("-skipupdate" !in args) checkForUpdate()
Initializer.arguments = args
Application.launch(Initializer::class.java)
}

private fun checkForUpdate() =
fun checkForUpdate() =
runBlocking(Dispatchers.IO) {
val localVersion =
Thread.currentThread().contextClassLoader.getResourceAsStream("version")?.bufferedReader()
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/com/spoiligaming/generator/gui/Initializer.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.spoiligaming.generator.gui

import com.spoiligaming.generator.GeneratorBean
import com.spoiligaming.generator.checkForUpdate
import com.spoiligaming.logging.Logger
import javafx.application.Application
import javafx.beans.binding.Bindings
Expand All @@ -21,10 +22,16 @@ import javafx.stage.StageStyle
import kotlin.system.exitProcess

class Initializer : Application() {
private var xOffset = 0.0
private var yOffset = 0.0
companion object {
lateinit var arguments: Array<String>

private var xOffset = 0.0
private var yOffset = 0.0
}

override fun start(primaryStage: Stage) {
if ("-skipupdate" !in arguments) checkForUpdate()

System.setProperty("prism.lcdtext", "false")
System.setProperty("prism.text", "t2k")

Expand Down
21 changes: 12 additions & 9 deletions src/main/kotlin/com/spoiligaming/logging/Logger.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.spoiligaming.logging

import javafx.application.Platform
import java.io.File
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
Expand All @@ -24,14 +25,16 @@ object Logger {
) = if (!nitroGenerationLog) {
log("OK", message, CEnum.GREEN)
} else {
println(
"${
createStatus(
CEnum.GREEN,
"OK",
)
} $message",
)
Platform.runLater {
println(
"${
createStatus(
CEnum.GREEN,
"OK",
)
} $message",
)
}
}

fun <V> printWarning(warning: V) = log("WARNING", warning, CEnum.YELLOW)
Expand All @@ -42,7 +45,7 @@ object Logger {
level: String,
message: V,
color: CEnum,
) {
) = Platform.runLater {
if (level != "DEBUG" || showDebug) {
println("${createStatus(color, level)} $message")
}
Expand Down

0 comments on commit 0225e28

Please sign in to comment.