7068471: NPE in sun.font.FontConfigManager.getFontConfigFont() when libfontconfig.so is not installed
authorprr
Tue, 19 Jul 2011 14:09:25 -0700
changeset 10085 7f82305d48d1
parent 10084 9d3f6507f55f
child 10086 a6dbbf4eb30f
7068471: NPE in sun.font.FontConfigManager.getFontConfigFont() when libfontconfig.so is not installed Reviewed-by: jgodinez, prr Contributed-by: spoole@linux.vnet.ibm.com
jdk/src/solaris/classes/sun/font/FontConfigManager.java
--- a/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Thu Jul 07 19:18:01 2011 -0700
+++ b/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Tue Jul 19 14:09:25 2011 -0700
@@ -347,6 +347,11 @@
         name = name.toLowerCase();
 
         initFontConfigFonts(false);
+        if (fontConfigFonts == null) {
+            // This avoids an immediate NPE if fontconfig look up failed
+            // but doesn't guarantee this is a recoverable situation.
+            return null;
+        }
 
         FcCompFont fcInfo = null;
         for (int i=0; i<fontConfigFonts.length; i++) {