Merge pull request #4923 from lioncash/master

Fix possible null ptr derefs in sceFont.cpp. Also fix typo in if statement comparison in sceNetAdhoc.cpp
This commit is contained in:
Henrik Rydgård 2013-12-27 23:47:49 -08:00
commit 80d73f3d93
2 changed files with 5 additions and 5 deletions

View File

@ -848,9 +848,9 @@ int sceFontGetCharImageRect(u32 fontHandle, u32 charCode, u32 charRectPtr) {
PGFCharInfo charInfo;
LoadedFont *font = GetLoadedFont(fontHandle, false);
auto fontLib = font->GetFontLib();
int altCharCode = fontLib == NULL ? -1 : fontLib->GetAltCharCode();
if (font) {
auto fontLib = font->GetFontLib();
int altCharCode = fontLib == NULL ? -1 : fontLib->GetAltCharCode();
font->GetPGF()->GetCharInfo(charCode, &charInfo, altCharCode);
Memory::Write_U16(charInfo.bitmapWidth, charRectPtr); // character bitmap width in pixels
Memory::Write_U16(charInfo.bitmapHeight, charRectPtr + 2); // character bitmap height in pixels

View File

@ -642,15 +642,15 @@ int sceNetAdhocPdpDelete(int id, int unknown) {
SceNetAdhocPdpStat * sock = pdp[id - 1];
// Valid Socket
if (socket != NULL) {
if (sock != NULL) {
// Close Connection
closesocket(sock->id);
// Remove Port Forward from Router
//sceNetPortClose("UDP", socket->lport);
//sceNetPortClose("UDP", sock->lport);
// Free Memory
// free(socket);
// free(sock);
// Free Translation Slot
pdp[id - 1] = NULL;