BottleCap's picture

Trying to run Example in Mono on OS X throws exception

Project:QuickFont - Text Printing and Font Generation Library
Category:bug report

The following exception is thrown when running the Example project:

System.NullReferenceException: Object reference not set to an instance of an object
at QuickFont.QBitmap.EmptyPixel (System.Drawing.Imaging.BitmapData bitmapData, Int32 px, Int32 py) [0x00019] in /Users/BottleCap/Projects/QuickFont/QuickFont/QBitmap.cs:67
at QuickFont.Builder.m__1 (System.Drawing.Imaging.BitmapData data, Int32 x, Int32 y) [0x00000] in /Users/sean/Projects/QuickFont/QuickFont/Builder.cs:198
at QuickFont.Builder.RetargetGlyphRectangleInwards (System.Drawing.Imaging.BitmapData bitmapData, QuickFont.QFontGlyph glyph, Boolean setYOffset, Byte alphaTolerance) [0x00178] in /Users/BottleCap/Projects/QuickFont/QuickFont/Builder.cs:225
at QuickFont.Builder.BuildFontData (System.String saveName) [0x0014d] in /Users/BottleCap/Projects/QuickFont/QuickFont/Builder.cs:518
at QuickFont.QFont.BuildFont (System.Drawing.Font font, QuickFont.QFontBuilderConfiguration config, System.String saveName) [0x00008] in /Users/BottleCap/Projects/QuickFont/QuickFont/QFont.cs:161
at QuickFont.QFont..ctor (System.String fileName, Single size, FontStyle style, QuickFont.QFontBuilderConfiguration config) [0x000af] in /Users/BottleCap/Projects/QuickFont/QuickFont/QFont.cs:84
at QuickFont.QFont..ctor (System.String fileName, Single size, QuickFont.QFontBuilderConfiguration config) [0x00000] in :0
at StarterKit.Game.OnLoad (System.EventArgs e) [0x00053] in /Users/BottleCap/Projects/QuickFont/Example/Game.cs:232
at OpenTK.GameWindow.OnLoadInternal (System.EventArgs e) [0x00000] in :0
at OpenTK.GameWindow.Run (Double updates_per_second, Double frames_per_second) [0x00000] in :0
at OpenTK.GameWindow.Run (Double updateRate) [0x00000] in :0
at StarterKit.Game.Main () [0x00006] in /Users/BottleCap/Projects/QuickFont/Example/Game.cs:787

Running MonoDevelop and OS X 10.7.4, does not occur using VS2010/VS2012 on Win7 32 & 64bit.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Deancooper's picture


I had this same exception, but was able to fix it by adding the following two lines into QBitmap.EmptyPixel:

if (py<0 || py >= bitmapData.Height) return true;
if (px<0 || px >= bitmapData.Width ) return true;