Skip to content

Commit 1e86a0c

Browse files
committed
Move null-check to called method.
Same as with the "textExtent" methods, the "stringExtent" method in GC could verify that the parameter is not null further down in the call-stack. Also get rid of commented code.
1 parent 413990a commit 1e86a0c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5876,11 +5876,11 @@ void apply() {
58765876
* </ul>
58775877
*/
58785878
public Point stringExtent (String string) {
5879-
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
58805879
return Win32DPIUtils.pixelToPointAsSufficientlyLargeSize(drawable, stringExtentInPixels(string), getZoom());
58815880
}
58825881

58835882
Point stringExtentInPixels (String string) {
5883+
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
58845884
checkNonDisposed();
58855885
checkGC(FONT);
58865886
int length = string.length();
@@ -5892,7 +5892,6 @@ Point stringExtentInPixels (String string) {
58925892
}
58935893
SIZE size = new SIZE();
58945894
if (length == 0) {
5895-
// OS.GetTextExtentPoint32(handle, SPACE, SPACE.length(), size);
58965895
OS.GetTextExtentPoint32(handle, new char[]{' '}, 1, size);
58975896
return new Point(0, size.cy);
58985897
} else {

0 commit comments

Comments
 (0)