Commit 4d812d1
committed
fix: add nil check for audio port handling
Added nil pointer checks when accessing audio port information to
prevent potential crashes when no audio ports are available. The code
now safely handles cases where GetTheFirstPort returns nil by adding
proper nil checks before accessing the CardName property and returning
early when no port is available.
Influence:
1. Test audio card removal when no audio ports are available
2. Verify audio playback behavior when switching between different audio
devices
3. Test system stability when audio devices are disconnected while in
use
4. Check that audio auto-pause functionality works correctly with valid
ports
fix: 为音频端口处理添加空指针检查
添加了对音频端口信息的空指针检查,防止在没有可用音频端口时出现潜在崩溃。
代码现在通过添加适当的空指针检查来安全处理GetTheFirstPort返回nil的情况,
在访问CardName属性之前进行检查,并在没有端口可用时提前返回。
Influence:
1. 测试在没有可用音频端口时的声卡移除功能
2. 验证在不同音频设备之间切换时的播放行为
3. 测试音频设备在使用过程中断开连接时的系统稳定性
4. 检查音频自动暂停功能在有效端口下的正常工作1 parent b009d00 commit 4d812d1
2 files changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| |||
0 commit comments