--- old/modules/javafx.graphics/src/main/native-font/coretext.c 2018-08-13 20:15:39.909218966 +0530 +++ new/modules/javafx.graphics/src/main/native-font/coretext.c 2018-08-13 20:15:39.647643973 +0530 @@ -673,11 +673,26 @@ { CTRunRef run = (CTRunRef)runRef; const CGPoint* positions = CTRunGetPositionsPtr(run); + CFIndex count = CTRunGetGlyphCount(run); + if (count == 0) { + return 0; + } + + CGPoint* tempPositions = NULL; + if (!positions) { + tempPositions = (CGPoint*) malloc(count * sizeof(CGPoint)); + if (!tempPositions) { + return 0; + } + + CTRunGetPositions(run, CFRangeMake(0, 0), tempPositions); + positions = tempPositions; + } + int j = 0; if (positions) { jfloat* buffer = (*env)->GetPrimitiveArrayCritical(env, bufferRef, NULL); if (buffer) { - CFIndex count = CTRunGetGlyphCount(run); int i = 0; while (i < count) { CGPoint pos = positions[i++]; @@ -687,6 +702,10 @@ (*env)->ReleasePrimitiveArrayCritical(env, bufferRef, buffer, 0); } } + + if (tempPositions) { + free(tempPositions); + } return j; }