From e079ebd121b64d32a976eb5068c7b7a619062cc3 Mon Sep 17 00:00:00 2001 From: "attinasi%netscape.com" Date: Tue, 2 May 2000 22:38:58 +0000 Subject: [PATCH] checks for null strings. test programs only. git-svn-id: svn://10.0.0.236/trunk@67932 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/tests/TestAttributes.cpp | 8 +++++++- mozilla/layout/html/tests/TestCSSScanner.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mozilla/layout/html/tests/TestAttributes.cpp b/mozilla/layout/html/tests/TestAttributes.cpp index cea7e1576f2..bd46c42555e 100644 --- a/mozilla/layout/html/tests/TestAttributes.cpp +++ b/mozilla/layout/html/tests/TestAttributes.cpp @@ -73,6 +73,7 @@ void testAttributes(nsIHTMLContent* content) { nsISupportsArray* allNames; NS_NewISupportsArray(&allNames); + if (nsnull == allNames) return; PRInt32 na; content->GetAttributeCount(na); @@ -236,8 +237,13 @@ int main(int argc, char** argv) // Create test document. MyDocument *myDoc = new MyDocument(); + if (myDoc) { + testStrings(myDoc); + } else { + printf("Out of memory trying to create document\n"); + return -1; + } - testStrings(myDoc); // Create a new text content object. nsIContent *text; diff --git a/mozilla/layout/html/tests/TestCSSScanner.cpp b/mozilla/layout/html/tests/TestCSSScanner.cpp index 69be75d826b..a0dedb29d92 100644 --- a/mozilla/layout/html/tests/TestCSSScanner.cpp +++ b/mozilla/layout/html/tests/TestCSSScanner.cpp @@ -75,7 +75,13 @@ int main(int argc, char** argv) // Create scanner and set it up to process the input file nsCSSScanner* css = new nsCSSScanner(); + if (nsnull == css) { + printf("Out of memory allocating nsCSSScanner\n"); + return -1; + } + css->Init(uin); + // Scan the file and dump out the tokens nsCSSToken tok;