aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar lsalzman <lsalzman@mozilla.com>2016-06-07 19:08:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-07 19:08:58 -0700
commit2af4599b5c514933bf997d4837ddaaf24fc61cd7 (patch)
treecb788140af3bd1c34c0806e0a11f584719ed5650
parent4dbbd04314cc0606f8d3bafe515c97e52c180f73 (diff)
A Mozilla developer ran the µmix static analyzer on its codebase and incidentally found some issues regarding null checks in Skia. This fixes the issues that were found.
-rw-r--r--src/pathops/SkPathOpsWinding.cpp2
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp6
-rw-r--r--src/utils/win/SkDWriteFontFileStream.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/pathops/SkPathOpsWinding.cpp b/src/pathops/SkPathOpsWinding.cpp
index 0abffb0586..584ebd457a 100644
--- a/src/pathops/SkPathOpsWinding.cpp
+++ b/src/pathops/SkPathOpsWinding.cpp
@@ -289,10 +289,10 @@ bool SkOpSpan::sortableTop(SkOpContour* contourHead) {
bool ccw = ccw_dxdy(hit->fSlope, dir);
// SkASSERT(!approximately_zero(hit->fT) || !hit->fValid);
SkOpSpan* span = hit->fSpan;
- SkOpSegment* hitSegment = span->segment();
if (!span) {
return false;
}
+ SkOpSegment* hitSegment = span->segment();
if (span->windValue() == 0 && span->oppValue() == 0) {
continue;
}
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index e6e52d961a..bacac2ceef 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -45,7 +45,7 @@ public:
// Takes ownership of stream.
static HRESULT Create(SkStreamAsset* stream, StreamFontFileLoader** streamFontFileLoader) {
*streamFontFileLoader = new StreamFontFileLoader(stream);
- if (nullptr == streamFontFileLoader) {
+ if (nullptr == *streamFontFileLoader) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -110,7 +110,7 @@ public:
static HRESULT Create(IDWriteFactory* factory, IDWriteFontFileLoader* fontFileLoader,
StreamFontFileEnumerator** streamFontFileEnumerator) {
*streamFontFileEnumerator = new StreamFontFileEnumerator(factory, fontFileLoader);
- if (nullptr == streamFontFileEnumerator) {
+ if (nullptr == *streamFontFileEnumerator) {
return E_OUTOFMEMORY;
}
return S_OK;
@@ -207,7 +207,7 @@ public:
static HRESULT Create(IDWriteFontFileLoader* fontFileLoader,
StreamFontCollectionLoader** streamFontCollectionLoader) {
*streamFontCollectionLoader = new StreamFontCollectionLoader(fontFileLoader);
- if (nullptr == streamFontCollectionLoader) {
+ if (nullptr == *streamFontCollectionLoader) {
return E_OUTOFMEMORY;
}
return S_OK;
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index 460f90e6c4..6c73441e72 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -139,7 +139,7 @@ HRESULT SkDWriteFontFileStreamWrapper::Create(SkStreamAsset* stream,
SkDWriteFontFileStreamWrapper** streamFontFileStream)
{
*streamFontFileStream = new SkDWriteFontFileStreamWrapper(stream);
- if (nullptr == streamFontFileStream) {
+ if (nullptr == *streamFontFileStream) {
return E_OUTOFMEMORY;
}
return S_OK;