From 3f1467378e0b9ad15fe14db6884ecb2ff6c33780 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 27 Mar 2023 23:10:13 +0300 Subject: [PATCH] Check if Display is valid --- Kernel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Kernel.cpp b/Kernel.cpp index b1d7d3e..22254ee 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -182,7 +183,13 @@ extern bool EnableProfiler; // For the Display class. Printing on first buffer as default. int PutCharBufferIndex = 0; -EXTERNC void putchar(char c) { Display->Print(c, PutCharBufferIndex); } +EXTERNC void putchar(char c) +{ + if (Display) + Display->Print(c, PutCharBufferIndex); + else + UniversalAsynchronousReceiverTransmitter::UART(UniversalAsynchronousReceiverTransmitter::COM1).Write(c); +} EXTERNC void KPrint(const char *Format, ...) { @@ -197,7 +204,7 @@ EXTERNC void KPrint(const char *Format, ...) va_end(args); putchar('\n'); - if (!Config.BootAnimation) + if (!Config.BootAnimation && Display) Display->SetBuffer(0); }