mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-16 00:16:04 +00:00
StringBuffer.java (insert(int,char[])): Avoid NullPointerException so proper check of offset can be done.
* java/lang/StringBuffer.java (insert(int,char[])): Avoid NullPointerException so proper check of offset can be done. From-SVN: r38132
This commit is contained in:
@@ -454,7 +454,9 @@ public final class StringBuffer implements Serializable
|
||||
*/
|
||||
public StringBuffer insert (int offset, char[] data)
|
||||
{
|
||||
return insert (offset, data, 0, data.length);
|
||||
// One could check if offset is invalid here instead of making sure that
|
||||
// data isn't null before dereferencing, but this works just as well.
|
||||
return insert (offset, data, 0, data == null ? 0 : data.length);
|
||||
}
|
||||
|
||||
/** Insert the <code>char[]</code> argument into this
|
||||
|
||||
Reference in New Issue
Block a user