gwt-dnd icon indicating copy to clipboard operation
gwt-dnd copied to clipboard

NPE in PickupDragController.dragEnd() with null context.dropController

Open cueman opened this issue 8 years ago • 0 comments

In PickupDragController, lots of code is careful to check whether context.dropController is null or not. On dragStart(), context.dropController can be set, but is sometimes left null.

dragMove() should set context.dropController, so it ought to be non-null by the time dragEnd() is called. However, I'm finding in production that there are null pointer exceptions that I've traced back to context.dropController being null when dragEnd() is called.

This happens because PickupDragController.dragEnd() always calls a method on context.dropController, even if it is null.

Looking at the code, it appears to me that context.dropController will always be set to a non-null value by dragMove(). This suggests that sometimes dragMove() isn't being called. I've not been able to replicate this, but I've seen exceptions that show it happens infrequently across my users, but often enough to be a problem. Perhaps this can happen when the computer or browser is under heavy load.

Perhaps the solution is simply to make PickupDragController.dragEnd() check whether context.dropController is null or not before calling methods on it.

cueman avatar Jun 03 '16 09:06 cueman