Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430392

Summary: setFont NullPointerException
Product: [Tools] GEF Reporter: Oliver Baumgarten <Baumgarten>
Component: GEF-Legacy Draw2dAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: heiko.boettger, nyssen
Version: 3.9.1   
Target Milestone: 3.9.100 (Luna) M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Oliver Baumgarten CLA 2014-03-14 09:53:39 EDT
Affecting class FigureUtilities method setFont(Font).
Similar to Bug ID 308964 https://bugs.eclipse.org/bugs/show_bug.cgi?id=308964

Calling setFont(null):

Code snipplet:
if (appliedFont == f || f.equals(appliedFont))
   return;

1. When appliedFont == null there is no problem when argument f is also null.
2. When appliedFont != null f.equals causes a NullpointerException because f == null.
Comment 1 Alexander Nyßen CLA 2014-03-23 20:15:22 EDT
Changed the initial check in setFont() to the following:

if (appliedFont == f || (f != null && f.equals(appliedFont)))
  return

Changes pushed to origin/master, will be available in 3.9.2 M7 (Luna).
Comment 2 Alexander Nyßen CLA 2014-03-23 20:17:09 EDT
*** Bug 308964 has been marked as a duplicate of this bug. ***
Comment 3 Alexander Nyßen CLA 2014-07-12 05:49:03 EDT
Update milestone to reflect that Luna M7 was changed to be 3.9.100 instead of 3.9.2.