Fix error behavior of getUnusedGraphicName

Currently does not return an error code, just leaves memory uninitialized.