Remove most uses of direct comparison to Null objects
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index ce6ee1e..bcf89e4 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -238,9 +238,9 @@
 
       hb_blob_t *head_blob = hb_sanitize_context_t().reference_table<head> (face);
       const head *head_table = head_blob->as<head> ();
-      if (head_table == &Null(head) || (unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0)
+      if (head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0)
       {
-	/* head table is not present, or in an unknown format.  Leave num_glyphs=0, that takes care of disabling us. */
+	/* Unknown format.  Leave num_glyphs=0, that takes care of disabling us. */
 	hb_blob_destroy (head_blob);
 	return;
       }
@@ -270,7 +270,7 @@
     inline bool get_composite (hb_codepoint_t glyph,
 			       CompositeGlyphHeader::Iterator *composite /* OUT */) const
     {
-      if (this->glyf_table == &Null(glyf) || !num_glyphs)
+      if (unlikely (!num_glyphs))
 	return false;
 
       unsigned int start_offset, end_offset;
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index 965e30a..fded120 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -141,8 +141,8 @@
 					 * -1: Only strongly right to left;
 					 * -2: Like -1 but also contains neutrals. */
   public:
-  HBINT16	indexToLocFormat;	/* 0 for short offsets, 1 for long. */
-  HBINT16	glyphDataFormat;	/* 0 for current format. */
+  HBUINT16	indexToLocFormat;	/* 0 for short offsets, 1 for long. */
+  HBUINT16	glyphDataFormat;	/* 0 for current format. */
 
   DEFINE_SIZE_STATIC (54);
 };
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index 60a8d3a..d2b41a8 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -349,6 +349,7 @@
     ComponentGlyph	= 4
   };
 
+  inline bool has_data (void) const { return version.to_int () != 0; }
   inline bool has_glyph_classes (void) const { return glyphClassDef != 0; }
   inline unsigned int get_glyph_class (hb_codepoint_t glyph) const
   { return (this+glyphClassDef).get_class (glyph); }
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f3566ab..40a2fc4 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -2320,6 +2320,7 @@
 
 struct GSUBGPOS
 {
+  inline bool has_data (void) const { return version.to_int () != 0; }
   inline unsigned int get_script_count (void) const
   { return (this+scriptList).len; }
   inline const Tag& get_script_tag (unsigned int i) const
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index bfde063..09ff0e6 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -904,7 +904,7 @@
 hb_bool_t
 hb_ot_layout_has_substitution (hb_face_t *face)
 {
-  return &_get_gsub (face) != &Null(OT::GSUB);
+  return _get_gsub (face).has_data ();
 }
 
 /**
@@ -1006,7 +1006,7 @@
 hb_bool_t
 hb_ot_layout_has_positioning (hb_face_t *face)
 {
-  return &_get_gpos (face) != &Null(OT::GPOS);
+  return _get_gpos (face).has_data ();
 }
 
 void
@@ -1341,5 +1341,5 @@
 // hb_bool_t
 // hb_ot_base_has_data (hb_face_t *face)
 // {
-//   return &_get_base (face) != &Null(OT::BASE);
+//   return _get_base (face).has_data ();
 // }
diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh
index 5fef2d2..2dd7145 100644
--- a/src/hb-ot-math-table.hh
+++ b/src/hb-ot-math-table.hh
@@ -686,6 +686,8 @@
 {
   static const hb_tag_t tableTag	= HB_OT_TAG_MATH;
 
+  inline bool has_data (void) const { return version.to_int () != 0; }
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc
index e7cb465..66ce207 100644
--- a/src/hb-ot-math.cc
+++ b/src/hb-ot-math.cc
@@ -55,7 +55,7 @@
 hb_bool_t
 hb_ot_math_has_data (hb_face_t *face)
 {
-  return &_get_math (face) != &Null(OT::MATH);
+  return _get_math (face).has_data ();
 }
 
 /**
diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh
index 2803feb..a55511a 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -313,6 +313,7 @@
   if (arabic_fallback_plan_init_win1256 (fallback_plan, plan, font))
     return fallback_plan;
 
+  assert (fallback_plan->num_lookups == 0);
   free (fallback_plan);
   return const_cast<arabic_fallback_plan_t *> (&Null(arabic_fallback_plan_t));
 }
@@ -320,7 +321,7 @@
 static void
 arabic_fallback_plan_destroy (arabic_fallback_plan_t *fallback_plan)
 {
-  if (!fallback_plan || fallback_plan == &Null(arabic_fallback_plan_t))
+  if (!fallback_plan || fallback_plan->num_lookups == 0)
     return;
 
   for (unsigned int i = 0; i < fallback_plan->num_lookups; i++)
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 82d2996..101476e 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -87,6 +87,8 @@
 {
   static const hb_tag_t tableTag	= HB_OT_TAG_fvar;
 
+  inline bool has_data (void) const { return version.to_int () != 0; }
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index 366860d..6081ddf 100644
--- a/src/hb-ot-var.cc
+++ b/src/hb-ot-var.cc
@@ -65,7 +65,7 @@
 hb_bool_t
 hb_ot_var_has_data (hb_face_t *face)
 {
-  return &_get_fvar (face) != &Null(OT::fvar);
+  return _get_fvar (face).has_data ();
 }
 
 /**
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 9e8e2af..411c6b8 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -83,7 +83,7 @@
 
   hb_tag_t tag = TableType::tableTag;
   hb_bool_t result = false;
-  if (table != &Null(TableType))
+  if (source_blob->data)
   {
     result = table->subset(plan);
   } else {
diff --git a/src/main.cc b/src/main.cc
index c6e05fc..98a1320 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -53,7 +53,7 @@
 
   hb_blob_t *font_blob = hb_sanitize_context_t().sanitize_blob<OpenTypeFontFile> (blob);
   const OpenTypeFontFile* sanitized = font_blob->as<OpenTypeFontFile> ();
-  if (sanitized == &Null(OpenTypeFontFile))
+  if (!font_blob->data)
   {
     printf ("Sanitization of the file wasn't successful. Exit");
     return 1;