Merge "Fixed rest of null pointer warnings."
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index 5865838..fb307a9 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -291,13 +291,12 @@
       }
 
       clang::RecordDecl *RD = T->getAsStructureType()->getDecl();
-      if (RD != nullptr) {
-        RD = RD->getDefinition();
-        if (RD == nullptr) {
-          ReportTypeError(Context, nullptr, T->getAsStructureType()->getDecl(),
-                          "struct is not defined in this module");
-          return nullptr;
-        }
+      slangAssert(RD);
+      RD = RD->getDefinition();
+      if (RD == nullptr) {
+        ReportTypeError(Context, nullptr, T->getAsStructureType()->getDecl(),
+                        "struct is not defined in this module");
+        return nullptr;
       }
 
       if (!TopLevelRecord) {
@@ -537,12 +536,11 @@
         return false;
       }
 
-      if (RD != nullptr) {
-        RD = RD->getDefinition();
-        if (RD == nullptr) {
-          // FIXME
-          return true;
-        }
+      slangAssert(RD);
+      RD = RD->getDefinition();
+      if (RD == nullptr) {
+        // FIXME
+        return true;
       }
 
       // Fast check
@@ -1059,8 +1057,10 @@
     // declaration for an RS object type (or an array of one).
     const clang::FieldDecl *FD = *FI;
     const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
-    while (FT && FT->isArrayType()) {
+    slangAssert(FT);
+    while (FT->isArrayType()) {
       FT = FT->getArrayElementTypeNoTypeQual();
+      slangAssert(FT);
     }
 
     DataType DT = GetRSSpecificType(FT);
@@ -1079,9 +1079,6 @@
           // Ignore all other primitive types
           break;
       }
-      while (FT && FT->isArrayType()) {
-        FT = FT->getArrayElementTypeNoTypeQual();
-      }
       if (FT->isStructureType()) {
         // Recursively handle structs of structs (even though these can't
         // be exported, it is possible for a user to have them internally).
diff --git a/slang_rs_object_ref_count.cpp b/slang_rs_object_ref_count.cpp
index 2471473..54d83d2 100644
--- a/slang_rs_object_ref_count.cpp
+++ b/slang_rs_object_ref_count.cpp
@@ -585,9 +585,11 @@
     bool IsArrayType = false;
     clang::FieldDecl *FD = *FI;
     const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
+    slangAssert(FT);
     const clang::Type *OrigType = FT;
-    while (FT && FT->isArrayType()) {
+    while (FT->isArrayType()) {
       FT = FT->getArrayElementTypeNoTypeQual();
+      slangAssert(FT);
       IsArrayType = true;
     }
 
@@ -1297,8 +1299,10 @@
   const clang::Type *T = RSExportType::GetTypeOfDecl(VD);
 
   // Loop through array types to get to base type
-  while (T && T->isArrayType()) {
+  slangAssert(T);
+  while (T->isArrayType()) {
     T = T->getArrayElementTypeNoTypeQual();
+    slangAssert(T);
   }
 
   bool DataTypeIsStructWithRSObject = false;
@@ -1737,6 +1741,7 @@
 
   clang::CompoundStmt *CS = BuildCompoundStmt(mCtx, StmtList, loc);
 
+  slangAssert(FD);
   FD->setBody(CS);
   // We need some way to tell if this FD is generated by slang
   FD->setImplicit();