Guard against undefined values in text mode#1587
Conversation
|
The value of
Do you mean a resize to 0 text columns? Is there a way for me to reproduce this scenario? |
|
Maybe I'm overlooking something, but from what I can find the number of text screen rows or columns should never be |
|
It was very rare for me, so I'm not sure I will have the ability to reproduce this again. I just had a definitive crash, and this is ostensibly the fix. I found the crash in my clipboard history, see below. It's possible I was too defensive checking all the variables for The crash: I could also extract this from Line 12 character ~219 function va(a,b){function c(w){w=w.toString(16);return"#"+"0".repeat(6-w.length)+w}function d(w){var t=256*ja,// ...And I think the call site is here (note in this case that Line 20 character ~371 |
|
Thank you for your quick responses (also in your other PR earlier). As a suggestion, here's a simpler approach to fix this at an earlier point in the code (outside the for-loop). In function if(gfx_width === 0)
{
return 0; // rows have 0px width: nothing visible to render
}This is the only modification needed, and I think it makes sense to guard against this corner-case (even though its circumstances are not fully understood). By the way, your edit ("The crash:...") makes a lot of sense, as this would first crash in function |
I found that the whole render path could crash due to an
undefinedvalue in text mode colors. This is a quick fix for that. (Using more TypeScript would help a lot for this sort of bug!)