I don't have CS2, so I can't try this, but at least on CS6, CC runs ok.
It checks if the active layer is not background and it is a normal pixel layer (avoiding errors)
Then it runs inside a try...catch (this avoids the error that occurs when we don't use any warp and only apply it.
if (!app.activeDocument.activeLayer.isBackgroundLayer && app.activeDocument.activeLayer.kind == LayerKind.NORMAL) { try{ app.runMenuItem(stringIDToTypeID('warp')); }catch(e){}
}