Commit fb8897e
committed
fix keyvalues encode crash
Accomplished in exchange for my sanity, and a peek at Valve's work.
Effectively, the bug is that m_pSub can be null, so when it does
`dat->m_pSub->WriteAsBinary( buffer );`, it would be running
WriteAsBinary with `this` set to null. So, if we detect a null m_pSub,
we write a empty keyvalues structure manually by writing the ending
marker directly. The previous "fix" for this accidentally did exactly
this, just in a more roundabout way.
Valve's solution seems to go about this fix by checking if `this` is
null, at least in the decompiled code, but that method didn't work for
me (presumably due to compiler optimizations).1 parent d99a2a0 commit fb8897e
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2607 | 2607 | | |
2608 | 2608 | | |
2609 | 2609 | | |
2610 | | - | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
2611 | 2619 | | |
2612 | 2620 | | |
2613 | 2621 | | |
| |||
0 commit comments