Repository: microsoft/terminal (language: cpp)

Issue:
Using a soft font causes the Atlas engine to crash
### Windows Terminal version

1.18.1421.0

### Windows build number

10.0.19045.2913

### Other Software

_No response_

### Steps to reproduce

1. Make sure the Atlas engine is activated in the Advanced profile settings.
2. Open a bash shell.
3. Execute `printf "\eP0;1;1;4;2;1{B~~~~~~~~/~~~~~~~~\e\\"`

### Expected Behavior

Most characters output at this point should be reverse question marks, except for `!` which should map to a solid block.

### Actual Behavior

The terminal crashes. This is caused by a null pointer reference when accessing the `fontFaceEntry.fontFace` field in `BackendD3D::_initializeFontFaceEntry`.

https://github.com/microsoft/terminal/blob/c589784b54d46187289651fa6c04c49fe05826aa/src/renderer/atlas/BackendD3D.cpp#L1158

Just based on a brief scan of the code, I got the impression that it's expected for the `fontFace` to be null when you have a soft font, so it may just be that this method hasn't allowed for that case. This appears to be a regression introduced in PR #15343.



Discussion / hints:
Ah dang I didn't test it again after the PR. 😟 Sorry for breaking it, and thank you so much for noticing it!
(#15343 was written in a bit... a lot of a hurry. 😅)

Fix patch:
diff --git a/src/renderer/atlas/BackendD3D.cpp b/src/renderer/atlas/BackendD3D.cpp
index 6e26a2cbdad..6415160454d 100644
--- a/src/renderer/atlas/BackendD3D.cpp
+++ b/src/renderer/atlas/BackendD3D.cpp
@@ -1145,6 +1145,11 @@ void BackendD3D::_drawTextOverlapSplit(const RenderingPayload& p, u16 y)
 
 void BackendD3D::_initializeFontFaceEntry(AtlasFontFaceEntryInner& fontFaceEntry)
 {
+    if (!fontFaceEntry.fontFace)
+    {
+        return;
+    }
+
     ALLOW_UNINITIALIZED_BEGIN
     std::array<u32, 0x100> codepoints;
     std::array<u16, 0x100> indices;


Test patch: