With this function you can get the current surface target. If no surface is set (ie: default drawing to the application surface), then the function will return -1, otherwise it will return a positive integer which is the unique ID that identifies the surface being targeted (as returned when the surface was created using surface_create()).
Integer (-1 for no surface target, or a surface ID value)
surface_get_target() != -1
draw_surface(surf, 0, 0);
The above code will check to see if the current render target is a surface or not, and if it is, it resets the target then draws a surface.