@@ -1617,14 +1617,43 @@ private void buttonIPScannerOpenDir_Click(object sender, EventArgs e)
16171617
16181618 private void buttonTuyaConfig_CopyJSONToClipBoard_Click ( object sender , EventArgs e )
16191619 {
1620- Clipboard . SetText ( textBoxTuyaCFGJSON . Text ) ;
1620+ string text = textBoxTuyaCFGJSON ? . Text ;
1621+ if ( string . IsNullOrEmpty ( text ) )
1622+ {
1623+ MessageBox . Show ( "No JSON text available to copy." , "Copy to clipboard" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
1624+ }
1625+ else
1626+ {
1627+ try
1628+ {
1629+ Clipboard . SetText ( text ) ;
1630+ }
1631+ catch ( Exception ex )
1632+ {
1633+ MessageBox . Show ( "Failed to copy to clipboard: " + ex . Message , "Clipboard error" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
1634+ }
1635+ }
16211636 }
16221637
16231638 private void buttonTuyaConfig_CopyTextToClipBoard_Click ( object sender , EventArgs e )
16241639 {
1625- Clipboard . SetText ( textBoxTuyaCFGText . Text ) ;
1640+ string text = textBoxTuyaCFGText ? . Text ;
1641+ if ( string . IsNullOrEmpty ( text ) )
1642+ {
1643+ MessageBox . Show ( "No text description available to copy." , "Copy to clipboard" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
1644+ }
1645+ else
1646+ {
1647+ try
1648+ {
1649+ Clipboard . SetText ( text ) ;
1650+ }
1651+ catch ( Exception ex )
1652+ {
1653+ MessageBox . Show ( "Failed to copy to clipboard: " + ex . Message , "Clipboard error" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
1654+ }
1655+ }
16261656 }
1627-
16281657 private void linkLabel5_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
16291658 {
16301659 System . Diagnostics . Process . Start ( "https://www.youtube.com/watch?v=WunlqIMAdgw" ) ;
0 commit comments