@@ -1257,6 +1257,12 @@ export default class I18nPlugin extends AdminForthPlugin {
12571257 if ( resourceId !== this . resourceConfig . resourceId ) {
12581258 return { error : 'Invalid resourceId' } ;
12591259 }
1260+ if ( ! field ) {
1261+ return { error : 'No field provided' } ;
1262+ }
1263+ if ( recordId === undefined || recordId === null ) {
1264+ return { error : 'No recordId provided' } ;
1265+ }
12601266 const resource = this . adminforth . config . resources . find ( r => r . resourceId === resourceId ) ;
12611267 // Create update object with just the single field
12621268 const updateRecord = { [ field ] : value } ;
@@ -1270,6 +1276,11 @@ export default class I18nPlugin extends AdminForthPlugin {
12701276 // put into lock so 2 editors will not update the same record at the same time
12711277 oldRecord = await connector . getRecordByPrimaryKey ( resource , recordId )
12721278
1279+ if ( ! oldRecord ) {
1280+ result = { error : 'Record not found' } ;
1281+ return ;
1282+ }
1283+
12731284 if ( this . options . reviewedCheckboxesFieldName ) {
12741285 let oldValue ;
12751286 if ( ! oldRecord [ this . options . reviewedCheckboxesFieldName ] ) {
@@ -1307,7 +1318,11 @@ export default class I18nPlugin extends AdminForthPlugin {
13071318 handler : async ( { body, tr, adminUser } ) => {
13081319 const selectedLanguages = body . selectedLanguages ;
13091320 const selectedIds = body . selectedIds ;
1310-
1321+
1322+ if ( ! Array . isArray ( selectedIds ) || selectedIds . length === 0 ) {
1323+ return { ok : false , error : 'No records selected' } ;
1324+ }
1325+
13111326 const jobId = await this . bulkTranslate ( { selectedIds, selectedLanguages, adminUser } ) ;
13121327
13131328 return {
0 commit comments